Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Your solution will entail writing a function called TimeDifference and a test main that demonstrates that you can compute the time difference in minutes between the two times.

TimeDifference is a function that receives a start time and end time that are structs of your creation.

You need to compute the difference in minutes between the start time and end time, returning the number of minutes to your test main.

If the end time is less than the start time it means we have rolled over by a single day and you will need to correct the difference to accommodate the time rollover. Time will be in 24 hour format, rather than AM and PM.

This is easier than you might think. What would happen if you determined the start and end times in total minutes? If you subtracted the start total minutes from the end total minutes, wouldn't you have the difference in minutes?

If the result was less than zero, wouldn't it mean that you have rolled over a day and need to add the total minutes in a day to the difference you computed to get the correct answer? Of course, you can use any other strategy you want!

Your Test Main must:

1. Create two variables of a structure (using the typedef). I named mine TheStart and TheEnd)

TheStart contains 11 hours, 52 minutes

TheEnd contains 14 hours, 43 minutes

2. Print out the contents of TheStart and TheEnd

3. Call TimeDifference (TheStart, TheEnd). On return, print out the number of minutes.

4. Call TimeDifference (TheEnd, TheStart). On return, print out the number of minutes.

For your convenience, here is the output of my program:

TheStart is HH:11 MM:52

TheEnd is HH:14 MM:43 time from TheStart to TheEnd is : 171

time from TheEnd to TheStart is : 1269

Notes: 1. There is no printing anywhere but from your main().

2. You must submit the code and the output from program execution.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93122114

Have any Question?


Related Questions in Computer Engineering

Savings account balance write a program that calculates the

Savings Account Balance Write a program that calculates the balance of a savings account at the end of a period of time. It should ask the user for the annual interest rate, the starting balance, and the number of months ...

Suppose that a data warehouse consists of the four

Suppose that a data warehouse consists of the four dimensions date, spectator, location, and game, and the two measures count and charge, where charge is the fare that a spectator pays when watching a game on a given dat ...

A sequence of natural numbers a1 a2 an is said to be a

A sequence of natural numbers (a 1 , a 2 , ..., a n ) is said to be a degree sequence if there exists an undirected graph on n vertices {v 1 , v 2 , ..., v n } such that the degree of v i  is a i  for each i = 1, 2, ..., ...

Describe some of the advantages and disadvantages of using

Describe some of the advantages and disadvantages of using the N-version programming approach.

Start from scratch on each of the parts write a main

Start from scratch on each of the parts. Write a main function that declares an array of 100 doubles. In a for loop, assign each of the doubles a random number between 0.50 and 50.00. Here's how. array[i] = (double) (ran ...

Suppose in equilibrium and in a closed economy at the point

Suppose, in equilibrium and in a closed economy, at the point of tangency between the iso-value line and the ppf, we observe that MPLf= 8 MPLm= 2 and PM=1 what is Pf? what is the wage?

One of the assays your laboratory carries out requires a 2n

One of the assays your laboratory carries out requires a 2N HCl. You have a stock bottle of concentrated HCl with a specific gravity of 1.18 and purity of 36%. What volume of the concentrated HCl is required to make 250m ...

Alpine company stock is selling for 3240 a share one 30

Alpine Company stock is selling for $32.40 a share. One $30 call is valued at $2.76 and one $29 put is valued at $.65. What is the value of three call option contracts (remember that one contract includes 100 options)?

List and describe the threats posted to information

List and describe the threats posted to information security and common attacks associated with those attacks

How do you calculate the annual interest rate of 12

How do you calculate the annual interest rate of 12% compounded monthly. I know how to do for annually but not monthly. You are offered the opportunity to put some money away for retirement. You will receive 10 annual pa ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As