Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C++ please 1. Complete the implementation of the class time24 as declared in the program time24.h. Do not modify the main

image text in transcribedimage text in transcribed

Write a program in C++ please

1. Complete the implementation of the class time24 as declared in the program time24.h. Do not modify the main program. You must write the four methods of the class and the two functions write() and add(). Declaration of Class Time24 /* File: time24.h the class time 24 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. */ #ifndef TIME24 H #define TIME24 H #include using namespace std; class time24 { private: int hour; hour between 0 and 23 int minute: minute between 0 and 59 public: int gethour (void) const; return hour int getminute (void) const; return minute void sethour(int h); hour = void set minute(int m); minute = m }; void write (ostream & out, const time24 & x); prints hour: minute time24 add const time24 &x, const time24 & y); add i and y #endif /* TIME.4.1 / Implementation of Class Time 24 File: time24.cpp Implementation of class time 24 */ #include "time24.h" Methods of time 24 time 24 functions // Main Program Using Class Time 24 File: testtime24.cpp Application program using class time 24 Date: +/ // test the class Programmer: your name #include "time 24.h" int main(void) { time24 x, y, z; x.sethour (18): x.setminute (34): y.sethour (10): y.setminute (56); cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago