As I am writing this code, I have it set up where I can input values, but I am having difficulty with the math part. Do I have to put in "#define" and that formula before the "int main(void)" and insert the equation before the getch()? I know I have to tell the program that a is this, g is that, etc, but that is where I am stuck at. Here is the question and what I have so far is at the bottom:
Question:
Prompt the user to enter the following values:
1. Time of Day (hour from 0-23, in military time, let this be t)
2. Parking Spots Available (for the semester, let this be a)
3. Parking Permits Given (for the semester, let this be g)
After much observation, you have realized that the formula for determining the amount of time you will wait to get a parking spot is:
Time (in minutes) = (12 – | 12 – t |)*g/a
Input Specification
1. The time of day will be a single integer in between 0 and 23, inclusive, representing the hour the user is attempting to park.
2. This number of spots available will be a positive integer less than 50,000.
3. The number of permits given will be a positive integer less than 60,000.
Sample Run
What hour are you looking for parking?
10
How many spots are available this semester?
9000
How many parking permits were given this semester?
45000
You will have to wait 50.00 minutes to find parking.
__________________________________________________ _____________________
(MY WORK SO FAR)
Code:#include <stdio.h> int main(void) { int hour, spots, parking_permits; float time; printf ("What hour are you looking for parking? \n"); scanf ("%d", &hour); printf ("How many spots are available this semester? \n"); scanf ("%d", &spots); printf ("How many parking permits were given this semester? \n"); scanf ("%d", &parking_permits); getch (); return 0; }