Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Time Format In Program 15-20 , the file Time.h contains a Time class. Design a class called MilTime that is derived from the Time class.

Time Format In Program 15-20 , the file Time.h contains a Time class. Design a class called MilTime that is derived from the Time class. The MilTime class should convert time in military (24-hour) format to the standard time format used by the Time class. The class should have the following member variables:

milHours: Contains the hour in 24-hour format. For example, 1:00 pm would be stored as 1300 hours, and 4:30 pm would be stored as 1630 hours.

milSeconds: Contains the seconds in standard format.

The class should have the following member functions: Constructor:

The constructor should accept arguments for the hour and seconds, in military format. The time should then be converted to standard time and stored in the hours, min, and sec variables of the Time class.

setTime: Accepts arguments to be stored in the milHours and milSeconds variables. The time should then be converted to standard time and stored in the hours, min, and sec variables of the Time class.

getHour: Returns the hour in military format.

getStandHr: Returns the hour in standard format.

Demonstrate the class in a program that asks the user to enter the time in military format. The program should then display the time in both military and standard format.

Input Validation: The MilTime class should not accept hours greater than 2359, or less than 0. It should not accept seconds greater than 59 or less than 0.

In C++ Please.

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

Students also viewed these Databases questions

Question

Solve the following equations. 0.5(x-3)=20

Answered: 1 week ago

Question

an element of formality in the workplace between different levels;

Answered: 1 week ago