Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this c++ program Create a class called Time and then write a driver program to test your class by creating some

I need help with this c++ program

Create a class called Time and then write a driver program to test your class by creating some objects and performing various operations. You will continue with this class in future labs so ask for help if needed! Your program must have at least three files: a Time header file (Time.h), a Time implementation file (Time.cpp), and an application file (TimeApp.cpp). The class has only two int data members hour and minute, with the hour defaults to 0 and the minute defaults to 0 (i.e., the constructor has two default arguments, hour and then minute in that order; note that the default time is 00:00 or 12:00 AM). The hour must be between 0 and 23 and the minute must be between 0 and 59 so validation is needed. Provide the following public member functions: Constructor (two default parameters); must verify that hour is between 0 and 23 and default to 0 if needed; must verify that minute is between 0 and 59 and default to 0 if needed. o Time(int h = 0, int m = 0); Setting the hour (must verify that the value is between 0 and 23 and keep current hour if applicable). o void setHour(int h); Setting the minute (must verify that the value is between 0 and 59 and keep current minute if applicable). o void setMinute(int m); Returning the hour. o int getHour(); Returning the minute. o int getMinute(); Printing the time in AM/PM format (like 1:05 AM, but not 1:5 AM). o void print(); Advancing the time by one minute (don't forget to adjust the hour if needed). o void advance();

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago