1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Goshia [24]
3 years ago
5

Write a program that allows the user to enter a start time and a future time. Include a function named compute Difference that t

akes 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 may 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.
Computers and Technology
1 answer:
Aleonysh [2.5K]3 years ago
7 0

Step 1

Following is the c++ program:

Variables used:

startHours, startMins are used to store the starting time of time machine.

futureHours, futureMins are used to store the future time of time machine.

xAM variable is used to store meridiem of start and future time.

isSAM is boolean variable that is true if starting time is AM.

isFAM is boolean variable that is true if future time is AM.

 

Functions:

main() is used to call computeDifference() function that will calculate the difference between the start and future time.

computeDifference() takes as input six variables from the user and then apply the following logic to compute the difference between the start and future time:

If Meridien of both start and future time are the same, then simply subtract the start time from the future time.

Difference = future minutes – start minutes

If Meridien of both start and future time are different, then apply the following formula to calculate difference:

Difference = (12 * 60 – start minutes) + future minutes

Step 2

Program :

#include <iostream> //header file for input and output

 

using namespace std;

//calculate the time difference(in minutes) between start time and future time.

int computeDifference(int startHours, int startMins, bool isSAM, int futureHours, int futureMins, bool isFAM) {

 int difference = 0; //to store difference

 startMins = startHours * 60 + startMins; //converting in minutes.

 futureMins = futureHours * 60 + futureMins; //converting in minutes.

 //applying formula for difference.

 if (isSAM == isFAM) {

   difference = futureMins - startMins;

 } else if (isSAM == true && isFAM == false) {

   difference = (12 * 60 - startMins) + futureMins;

 }

}

int main() {

 int startHours, startMins; //it will store start time

 int futureHours, futureMins; //it will store future time.

 string xAM; //it will store meridiem.

 bool isSAM; //it will be true if start time is AM.

 bool isFAM; //it will be true if future time is in AM.

 int difference = 0; //it will store difference.

 cout << "Enter start time of time machine as 'HH MM AM/PM': "; //take input from

You might be interested in
A collection of realated files is called a
Thepotemich [5.8K]

The answer to this question would be:

database/records

They all have in common the same files.

4 0
3 years ago
True or False: At the Company level, users will only have access to view projects to which they have been specifically granted a
Viktor [21]

Answer:here the link

Explanation:

4 0
2 years ago
Read 2 more answers
A set of blocks contains blocks of heights 1,2, and 4 centimeters. Imagine constructing towers of piling blocks of different hei
SashulF [63]

Answer:

In studies about new medicines, researchers usually give one group of patients the medicine that is designed to treat an illness. They give another group of patients a placebo, which is taken the same way as the medicine but does not actually contain the ingredients of any medicine. Different medicines are tested in different experiments, but the placebos usually contain the same non-medical ingredients. If both groups of patients are healed, then researchers cannot be sure whether the medicine caused improvement, but if the group given the medicine is healed while the group given the placebo remains ill, researchers can conclude that the medicine causes the illness to go away.

In medical experiments, which group receives placebos?

the experimental group

the control group

both the experimental and control groups

neither the experimental nor control group

Explanation:

5 0
3 years ago
A network administrator identifies sensitive files being transferred from a workstation in the LAN to an unauthorized outside IP
Sav [38]

Answer:

D. Zero-day

Explanation:

It is clearly stated that the antivirus is still up-to-date on the workstation, and there has been no alterations to the firewall. Hence, this means the software is functional and up-to-date with all known viruses. This shows that this attack is unknown to the manufacturer of the antivirus software and hence no virus definition or patch fixing this problem has been developed yet. In this light, it is a zero-day.

A zero-day is a type of vulnerability in a software that is not yet known to the vendor or manufacturer, hence this security hole makes the software vulnerable to attackers or hacker before it is been fixed.

4 0
3 years ago
US-CERT is a set of moderated mailing lists full of detailed, full-disclosure discussions and announcements about computer secur
n200080 [17]

Answer:

False

Explanation:

BugTraq is a high volume, full disclosure mailing list for the detailed discussion and announcement of computer security vulnerabilities, not US-CERT

3 0
2 years ago
Other questions:
  • Suppose we wish to put a set of names in alphabetical order. We call the act of doing so sorting. One algorithm that can accompl
    15·1 answer
  • In the u.s.all financial institutions are required to conduct business at a physical location only
    9·1 answer
  • To remove an embedded chart, you should _____ it and press the DELETE key.
    14·2 answers
  • Press the _______ key to move to the next cell in a row.
    12·2 answers
  • If you buy a 20 dollar thing with a 25 dollar gift card, do you still have 5 dollars?
    7·2 answers
  • Assign jsonData with the parsed value of the stringData variable. Then, assign 29 to the points property in jsonData and assign
    13·1 answer
  • True or False: <br> The object reference can be used to polymorphically store any class in Java.
    13·1 answer
  • Charlie does not think he will be able to finish his project by the deadline at this point in the decision making progress to so
    13·1 answer
  • what is the term for software that is exclusively controlled by a company, and cannot be used or modified without permission?
    6·1 answer
  • Budgeting for a Computer
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!