Programing Language: C++ Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a program that can take a start time (in hours, minutes, and a Boolean indicating AM or PM) and a future time (in hours, minutes, and a Boolean indicating AM or PM) and calculate the difference in minutes between the start and future time. A time is specified in your program with three variables: int hours, minutes; bool isAM; // You can also use a char, i.e. A or P for example, to represent 11:50 PM, you would store: hours = 11,minutes = 50, isAM = false or if using a char, hours = 11,minutes = 50, isAM = 'A' This means that you need six variables to store a start and future time. Write a program that allows the user to enter a start time and a future time. Include a function named computeDifference that takes the six variables as parameters that represent the start time and future time. Your function should return, as an int, the time difference in minutes. for example, given a start time of 11:59 AM and a future time of 12:01 PM, your program should compute 2 minutes as the time difference. Given a start time of 11:59 AM and a future time of 11:58 AM, your program should compute 1439 minutes as the time difference (23 hours and 59 minutes). You need “AM” or “PM” from the user’s input by reading in two character values. (Display 2.3 illustrates character input.) Characters can be compared just like numbers. for example, if the variable a_char is of type char, then (a_char == 'A')is a Boolean expression that evaluates to true if a_char contains the letter A

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter5: Looping
Section: Chapter Questions
Problem 13PE
icon
Related questions
Question
100%

Programing Language: C++

Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a program that can take a start time (in hours, minutes, and a Boolean indicating AM or PM) and a future time (in hours, minutes, and a Boolean indicating AM or PM) and calculate the difference in minutes between the start and future time.


A time is specified in your program with three variables:

int hours, minutes;

bool isAM; // You can also use a char, i.e. A or P


for example, to represent 11:50 PM, you would store:

hours = 11,minutes = 50, isAM = false or if using a char, hours = 11,minutes = 50, isAM = 'A'


This means that you need six variables to store a start and future time.

Write a program that allows the user to enter a start time and a future time. Include a function named computeDifference that takes the six variables as parameters that represent the start time and future time. Your function should return, as an int, the time difference in minutes. for example, given a start time of 11:59 AM and a future time of 12:01 PM, your program should compute 2 minutes as the time difference. Given a start time of 11:59 AM and a future time of 11:58 AM, your program should compute 1439 minutes as the time difference (23 hours and 59 minutes).

You need “AM” or “PM” from the user’s input by reading in two character values. (Display 2.3 illustrates character input.) Characters can be compared just like numbers. for example, if the variable a_char is of type char, then (a_char == 'A')is a Boolean expression that evaluates to true if a_char contains the letter A

A Microsoft Visual Studio Debug Console
Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM: 12:01 AM
Enter future time in the format 'HH:MM xm' where 'xm' is
either 'am' or 'pm': 1:02 PM
There are 781 minutes (13 hours and 1 minute) between 12:01 AM and 1:02PM.
A Microsoft Visual Studio Debug Console
Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM: 12:00 PM
Enter future time in the format 'HH:MM xm' where 'xm' is
either 'am' or 'pm': 1:05 PM
There are 65 minutes (1 hour and 5 minutes) between 12:00 PM and 1:05PM.
A Microsoft Visual Studio Debug Console
Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM: 12:05 AM
Enter future time in the format 'HH:MM xm' where 'xm' is
either 'am' or 'pm': 12:06 PM
There are 721 minutes (12 hours and 1 minute) between 12:05 AM and 12:06PM.
A Microsoft Visual Studio Debug Console
Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM: 11:00 PM
Enter future time in the format 'HH:MM xm' where 'xm' is
either 'am' or 'pm': 1:10 AM
There are 130 minutes (2 hours and 10 minutes) between 11:00 PM and 1:10AM.
Transcribed Image Text:A Microsoft Visual Studio Debug Console Enter start time, in the format 'HH:MM xm', where 'xm' is either 'am' or 'pm' for AM or PM: 12:01 AM Enter future time in the format 'HH:MM xm' where 'xm' is either 'am' or 'pm': 1:02 PM There are 781 minutes (13 hours and 1 minute) between 12:01 AM and 1:02PM. A Microsoft Visual Studio Debug Console Enter start time, in the format 'HH:MM xm', where 'xm' is either 'am' or 'pm' for AM or PM: 12:00 PM Enter future time in the format 'HH:MM xm' where 'xm' is either 'am' or 'pm': 1:05 PM There are 65 minutes (1 hour and 5 minutes) between 12:00 PM and 1:05PM. A Microsoft Visual Studio Debug Console Enter start time, in the format 'HH:MM xm', where 'xm' is either 'am' or 'pm' for AM or PM: 12:05 AM Enter future time in the format 'HH:MM xm' where 'xm' is either 'am' or 'pm': 12:06 PM There are 721 minutes (12 hours and 1 minute) between 12:05 AM and 12:06PM. A Microsoft Visual Studio Debug Console Enter start time, in the format 'HH:MM xm', where 'xm' is either 'am' or 'pm' for AM or PM: 11:00 PM Enter future time in the format 'HH:MM xm' where 'xm' is either 'am' or 'pm': 1:10 AM There are 130 minutes (2 hours and 10 minutes) between 11:00 PM and 1:10AM.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT