Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 438 Weeks Ago, 2 Days Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Programming Posted 03 May 2017 My Price 5.00

Create a class named Time that contains integer fields

Create a class named Time that contains integer fields for hours and minutes. Store the hours in military time, that is, 0 through 23. Add a function that displays the fields, using a colon to separate hours and minutes. (Make sure the minutes display as two digits. For example, 3 o’clock should display as 3:00, not 3:0.) Add another function that takes an argument that represents minutes to add to the time. The function updates the time based on the number of minutes added. For example, 12:30 plus 15 is 12:45, 14:50 plus 20 is 15:10, and 23:59 plus 2 is 0:01. The Time constructor requires an argument for hours. The argument for minutes is optional; the value defaults to 0 if no argument is supplied. The constructor ensures that the hours field is not greater than 23 and that the minutes field is not greater than 59; default to these maximum values if the arguments to the constructor are out of range. Create a main()function that instantiates an array of at least four Time objects and demonstrates that they display correctly both before and after varying amounts of time have been added to them. Save the file as Time.cpp. You will use the Time class in another exercise in this chapter.

 

Answers

(8)
Status NEW Posted 03 May 2017 10:05 AM My Price 5.00

-----------

Attachments

file 1493808140-answer1.docx preview (244 words )
C-----------rea-----------te -----------a c-----------las-----------s n-----------ame-----------d T-----------ime----------- th-----------at -----------con-----------tai-----------ns -----------int-----------ege-----------r f-----------iel-----------ds -----------for----------- ho-----------urs----------- an-----------d m-----------inu-----------tes-----------. S-----------tor-----------e t-----------he -----------hou-----------rs -----------in -----------mil-----------ita-----------ry -----------tim-----------e, -----------tha-----------t i-----------s, -----------0 t-----------hro-----------ugh----------- 23-----------. A-----------dd -----------a f-----------unc-----------tio-----------n t-----------hat----------- di-----------spl-----------ays----------- th-----------e f-----------iel-----------ds,----------- us-----------ing----------- a -----------col-----------on -----------to -----------sep-----------ara-----------te -----------hou-----------rs -----------and----------- mi-----------nut-----------es.----------- (M-----------ake----------- su-----------re -----------the----------- mi-----------nut-----------es -----------dis-----------pla-----------y a-----------s t-----------wo -----------dig-----------its-----------. F-----------or -----------exa-----------mpl-----------e, -----------3 o-----------’-----------clo-----------ck -----------sho-----------uld----------- di-----------spl-----------ay -----------as -----------3:0-----------0, -----------not----------- 3:-----------0.)----------- Ad-----------d a-----------not-----------her----------- fu-----------nct-----------ion----------- th-----------at -----------tak-----------es -----------an -----------arg-----------ume-----------nt -----------tha-----------t r-----------epr-----------ese-----------nts----------- mi-----------nut-----------es -----------to -----------add----------- to----------- th-----------e t-----------ime-----------. T-----------he -----------fun-----------cti-----------on -----------upd-----------ate-----------s
Not Rated(0)