Compute the time difference in minutes between the two time

Assignment Help Computer Engineering
Reference no: EM132134649

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.

Reference no: EM132134649

Questions Cloud

What is the value of x : A software has x bugs. A team finds 19 bugs in it. Another team finds 11 bugs in it. Of these, 3 bugs were common to both teams.
Design an algorithm that tests whether or not two input list : Design an algorithm that tests whether or not two input lists of size n have at least one element in common.
How is control managed within the architecture : Does a distinct control hierarchy exist, and if so, what is the role of components within this control hierarchy?
Prepare a sustainability assessment report : Prepare a sustainability assessment report referring to the Consolidated Set of GRI Sustainability Reporting Standards 2016 that specifically addresses
Compute the time difference in minutes between the two time : You need to compute the difference in minutes between the start time and end time, returning the number of minutes to your test main.
What are the best practices in writing program : Question: What are the best practices in writing program? Describe each one briefly.
Write a program using python that asks the user to enter : Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50%
Write a query that uses a scalar query in the select clause : Find the names and ids of the students who have taken all the courses that are offered by their departments.
How many sons were there and how large was the mans estate : A man left to his eldest son one bezant and a seventh of what was left; then from the remainder, to his next son he left two bezants.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd