Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The two questions is in line 32 and 37. #include #define MINS_PER_HOUR 60 /***********************************************************/ /* This program reads in the distance to be covered on

The two questions is in line 32 and 37. #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. */ /***********************************************************/ main() { int departHours, departMins, hours, mins, arrivalHours, arrivalMins; float distance, speed, travelTime; /***********************************************************/ /* 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); /***********************************************************/ /* 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; /* Question 1: Use line 25 to line 29 to calculate the following give data: distance = 230.9; TravelTime = 3:45; DepartHours = 6; departMins = 17; speed = 55; You will need at least 5 lines (do the actual hand calculation on line 25-29) to justify your answers; ====== your answer goes to here===== Question 2: Use line 25 to line 29 to calculate the following give data: distance = 125.9; TravelTime = 0:52; DepartHours = 6; departMins = 47; You will need at least 5 lines (do the actual hand calculation on line 25-29) to justify your answers; ====== your answer goes to here===== Use this program to veryfy your answers from question 1 and 2. */ /***********************************************************/ /* 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); return 0; } /* 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_2

Step: 3

blur-text-image_3

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions