Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The question is line 36 and 39. #include #define MINS_PER_HOUR 60 /***********************************************************/ /* This program reads in the distance to be covered on a */

The question is line 36 and 39. #include  #define MINS_PER_HOUR 60 /***********************************************************/ /* This program reads in the distance to be covered on a */ /* trip, our average speed, and our departure time. */ /* It calculates and prints our travel time and estimated*/ /* arrival time. */ /***********************************************************/ void getData(float *, float *, int *, int *); main() { int departHours, departMins, hours, mins, arrivalHours, arrivalMins; float distance, speed, travelTime; printf( "Travel calculation program: "); getData(&distance, &speed, &departHours, &departMins) ; /***********************************************************/ /* Calculate travel time and arrival time. */ /***********************************************************/ travelTime =distance/ speed; hours= travelTime; mins = (travelTime - hours) * MINS_PER_HOUR; arrivalHours = (departHours + hours + (departMins + mins) / MINS_PER_HOUR) % 24; arrivalMins = (departMins + mins) % MINS_PER_HOUR; /***********************************************************/ /* Print results. */ /***********************************************************/ printf(" Distance: %5.2f miles. ", distance); printf("Speed: %5.2f mph. ", speed); printf("Departure time: %.2d:%.2d. ", departHours, departMins); printf( "Trave l time: %02d:%02d. ", hours, mins); printf("Arrival time: %02d:%02d. ", arrivalHours, arrivalMins); /* Copy the entire question 1 and 2 here Question 3: change "Calculate travel time and arrival time" to a function call (name your function as your own wish) Test your changing by executing the modified program Question 4: change "Print results" section to a function call (name your function as your own wish) Test your changing by executing the modified program - Save this program as "IOFunctionfirstNameLastName.c" and submit the program to CSC292 - In the Blackbord, write the program path (in your UNIX account) and a screen shot of your submission, then click submit */ return 0; } void getData(float *distance, float *speed, int *departHours, int *departMins) { /***********************************************************/ /* Read in the distance, speed, and departure time. */ /* Departure time is in the form hh:rnrn. */ /***********************************************************/ printf( "Travel calculation program: "); printf("Distance to be traveled (miles): "); scanf("%f", distance); printf( "Speed of travel (mph): "); scanf("%f", speed); printf( "Departure (military) time (hh:rnrn): "); scanf("%d:%d", departHours, departMins); } /* Here's a sample run of the program: Travel calculation program: Distance to be traveled (miles): 147.5 Speed of travel (mph): 58.6 Departure (military) time (hh:rnrn): 12:38 Distance: 147.50 miles. Speed: 58.60 mph. Departure time: 12:38. Travel time: 02:31. Arrival time: 15:09. */ 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

all of the following are language translators except

Answered: 1 week ago

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago

Question

2. Why has the conflict escalated?

Answered: 1 week ago

Question

1. What might have led to the misinformation?

Answered: 1 week ago