Please write the program in C++ language 1. Complete the implementation of the class time24 as declared
Fantastic news! We've Found the answer you've been seeking!
Question:
Please write the program in C++ language
Transcribed Image Text:
1. Complete the implementation of the class time24 as declared in the program time24. cpp. Do not modify the main program. You must write the four methods of the class and the two functions write() and add(). Notes: • The attributes of time24 are hour, and minute. This allows us to use the names hour and minute for the methods. Instead of naming the methods sethour, setminute, gethour and getminute we use overloading of the method names hour and minute. • To print an integer r < 100 always with 2 digits use: cout <« x / 10 « x % 10; /* File: time24.cpp the class time24 represents time on 24 hour clock times are written to a stream in the form hour:minute when two times are added the minutes are added and if the sum is 60 or more then 60 is subtracted from the sum but the the hour is increased by 1. If the hour is 24 or more then 24 is subtracted from the hour. Programmer: your name Date: */ #include <iostream> #include <fstream> using namespace std; class time24 { private: int hour ; int minute ; // hour between 0 and 23 // minute between 0 and 59 public: int hour (void) const; int minute (void) const; void hour (int h); void minute(int m); // return hour. // return minute_ // hour = h // minute_ = m }; void write(ostream kout, const time24 &x); time24 add(const time24 &x, const time24 ky); // prints hour:minute // add x and y int main(void) // test the class { time24 x, y, z; x.hour (18); x.minute (34); 1. Complete the implementation of the class time24 as declared in the program time24. cpp. Do not modify the main program. You must write the four methods of the class and the two functions write() and add(). Notes: • The attributes of time24 are hour, and minute. This allows us to use the names hour and minute for the methods. Instead of naming the methods sethour, setminute, gethour and getminute we use overloading of the method names hour and minute. • To print an integer r < 100 always with 2 digits use: cout <« x / 10 « x % 10; /* File: time24.cpp the class time24 represents time on 24 hour clock times are written to a stream in the form hour:minute when two times are added the minutes are added and if the sum is 60 or more then 60 is subtracted from the sum but the the hour is increased by 1. If the hour is 24 or more then 24 is subtracted from the hour. Programmer: your name Date: */ #include <iostream> #include <fstream> using namespace std; class time24 { private: int hour ; int minute ; // hour between 0 and 23 // minute between 0 and 59 public: int hour (void) const; int minute (void) const; void hour (int h); void minute(int m); // return hour. // return minute_ // hour = h // minute_ = m }; void write(ostream kout, const time24 &x); time24 add(const time24 &x, const time24 ky); // prints hour:minute // add x and y int main(void) // test the class { time24 x, y, z; x.hour (18); x.minute (34);
Expert Answer:
Answer rating: 100% (QA)
include include using namespace std class time24 private int hour int minute public int hourvoid c... View the full answer
Related Book For
Automation Production Systems and Computer Integrated Manufacturing
ISBN: 978-0132393218
3rd edition
Authors: Mikell P.Groover
Posted Date:
Students also viewed these accounting questions
-
8) Write a program in C language Write a program to sort data in link list. 9) Write a program in C language Write a program to swap two nodes in double link list. 10) Write a program in C language...
-
Please write in Python Language to create a Program for Contact Management System. It is similar to the contact manager in cell phones. In this program, you can add, view, edit, search, and delete...
-
Please write an assembly language program for an MSP430 that before you push the button the green led is on and when you push the button 4 times a red light appears and stays on but green turns off...
-
Shoppers enter Hamilton Place Mall at an average of 120 per hour. What is the probability that at least 35 shoppers will enter the mall between 5:00 and 5:10 pm?
-
During your audit of the inventory account, you notice several adjustments made to the inventory account at the year-end. a. Identify several questions that you should ask of management regarding the...
-
What are some factors that should be considered in terms of the terminology used in computer dialogues?
-
Use the same information for Outdoor Experiences Pty Ltd in exercise 22.7. The accountant cant make decisions on the future of the company without your authority as manager, so he believes it is...
-
Fesler Inc. acquired all of the outstanding common stock of Pickett Company on January 1, 2009. Annual amortization of $22,000 resulted from this transaction. On the date of the takeover, Fesler...
-
THEORY OF STRUCTURES - INCLUENCE LINE FOR BEAMS Using the equilibrium method, draw the influence lines for the vertical reactions at ACD of the beam shown in the figure. Also, draw the influence line...
-
A researcher at a marketing firm examines whether the age of a consumer matters when buying athletic clothing. Her initial feeling is that Brand A attracts a younger customer, whereas the more...
-
Your client is a member of a partnership with a property management firm, ABC Properties. His partnership interest is 30% and last year the partnership made a net income of $750,000. Your client will...
-
What strategies can organizations employ to proactively identify and mitigate budgetary risks, such as cost overruns, revenue shortfalls, and unforeseen contingencies, in order to safeguard financial...
-
Develop a leadership philosophy statement. Begin by reviewing your self-assessment results from Topic 2 and reflect on what you have learned about effective leadership and conscious capitalism in the...
-
The Michigan Leadership Studies provided three leadership actions or courses of action (task-oriented, relationship-oriented, and participative leadership). Select and describe the course of action...
-
AA Corporations stock has a beta of 8. The risk-free rate is 4.5% and the expected return on the market is 13.6%. What is the required rate of return on AAs stock? The market and Stock J have the...
-
Victor Korchnoi bought a bond one month before a semi-annual coupon was due. The face value was $10,000 and the coupon rate 8.5%. At the time of purchase there were 34 coupons left and the YTM was 6%...
-
The Cueva Sada, SA factory produces several lines of items that include certain parts, which can be manufactured in the plant or externally. The cost of manufacturing one of the pieces, called...
-
The cash records of Holly Company show the following four situations. 1. The June 30 bank reconciliation indicated that deposits in transit total $720. During July, the general ledger account Cash...
-
What is shop floor control?
-
The typical operating cycle of the PLC, called a scan, consists of three parts: (1) input scan, (2) program scan, and (3) output scan. Briefly describe what is accomplished in each part.
-
What is an actuator?
-
Has the U.S. economy experienced inflation or deflation during recent recessions? Explain.
-
Inflation is soaring and employment is beginning to show sustained improvement. The unemployment rate is 6 percent, compared to its 3.5 percent rate prepandemic. The CPI grew 5.4 percent in June, and...
-
How do you think recessions influence elections?
Study smarter with the SolutionInn App