ENG-4007Y C Programming Competence - Assignment Help

Assignment Help on Phased Development of a Code With Loops, Conditions, Functions and Arrays

This assignment involves the phased development of a code with loops, conditions, functions and arrays. Marks will be awarded for demonstrating each different functionality and deducted for departures from the assignment specification (including the General Requirements below), errors or algorithm (i.e. the code doesn't work correctly) or poor coding style (e.g. deprecated 'shortcuts' such as jumping out of loops). 20 marks are available; 18 marks are needed to pass.

Phase 1 ,6 marks)

Write a program to record how regularly a user can repeatedly press the 'return' key on a keyboard. Your code must use the timesec() function provided' to measure elapsed time; either scanf_s() or getchar() can be used to input from the keyboard. Set up a loop to time the intervals between 15 key presses. You will also need to explain what the user has to do and say when you will start the timer for the first key press.

After each key press, report back to the user the time taken in seconds, to the nearest 0.01 second. Format your output so that 15 turns will fit on a single console screen.

Phase 3 ,4 marks)

Adapt your code to set the user a target reaction time to match (still 15 goes). The target time should be a random value between 1.0 and 4.0 seconds (specified to the nearest al sec). After each attempt report back whether their reaction time was within 0.05 sec (good), within 0.2 sec (close) or further than 0.5 sec away from the target (too slow or too fast).

Phase 4 (4 marks)

Adapt your code so that the loop of 15 attempts terminates early (by changing your loop control, not by jumping out of the loop halfway through) if the user gets within 0.05 sec of the target time on three attempts (they do not need to be consecutive). At the end of the loop, list how many times the user did this and, if three times, out of how many attempts.

An executable file demonstrating the operation of the game up to Phase 4 is available on Blackboard'. Phase 5 ,6 marks)

Add an outer loop around your loop-of-15 so that the user has to repeat the exercise up to four times with a different target time, but only if they make it within the 15 attempts each inner loop. Make sure your code explains to the user what is required for each game and when/why the game has ended. Set up array variables so that, at the end of the outer loop, you can summarise all the games in a table listing (a) the game number (b) the target time for that game (c) how many times the user achieved the target (d) the number of attempts taken.

General requirement,

  1. Your variable names must be at least six characters long. Remember you can use both upper- and lower-case characters and the underscore symbol,
  2. Comments should be included which explain the structure of your code (don't simply rewrite individual statements in words — e.g. writing 'add one to i' — this explains nothing)
  3. Correct function must be demonstrated by copying the output from the console and pasting it as a comment (enclosed by /* 'V) at the end of your code, after the end of your final closing brace
  4. The code must be uploaded with file name "AssignmentC.c" (Blackboard will add your user ID).

Expert's Answer

Need Urgent Academic Assistance?

Get Professional Help at Low Prices!

*
*
*


*

TOP
Order Notification

[variable_1] from [variable_2] has just ordered [variable_3] Assignment [amount] minutes ago.