Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The principal of a primary school has hired a jumping castle for the September s

ID: 3627689 • Letter: T

Question

The principal of a primary school has hired a jumping castle for the September school bazaar. Each child in the
school may jump once for free for 7 minutes. A whistle blows after every 7 minutes at which time the current group
of children gets off and the new group gets on and starts jumping. After 37 whistle blows, all children have jumped
for free. Your task is to write a program that will ask the user to enter a time in 24h00 format representing the time
that the first group started jumping. The user must enter the hours and minutes as two separate values, (i.e. a time of
10h45 will be entered as 10 45). The program then has to calculate the end time, i.e. the time when the last group
has finished their free jump. Use const variable definitions where applicable. Display the start time and the end time in the format hh:mm. Verify that the time entered is a legitimate time, using
the assert macro, e.g. 23 65 01 is not a valid time.

Explanation / Answer

What language does it need to be in?

Here is the pseudo code for C++

Should give basic logic

int hour = -1;
int min = -1;
int end_hr;
int end_min;
const int hours_add = 4; //7 *37 minutes gives 259 min or 4 hours 19 min
const int min_add = 19;
while (hour <0 && hour > 24)// stop the loop once a good time is entered
{
cout << "Enter an hour to start";
cin >> hour;
}
while (min < 0 && min > 60) // stop the loop once a good time is entered
{
cout << "Enter minutes to start";
cin >> min;
}

end_min = min + 19

if(end_min > 60)
{
end_hour += 1 ;
end_minutes -= 60; //subtract 60 min
}

end_hours = hours + 4;
if( end_hours > 24)
{
int hours_over = 0;
hours_over = end_hours - 24;
end_hours = hours_over
}

cout << setprecission(2) <<"Start time "<< hour << ":" << min;
cout << setprecission(2) <<"EndTime time "<< end_hour << ":" << end_min;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote