Question: IN the app VISUAL STUDIO CODE, please complete the following. Without changing the makefile: flags = - std = c + + 1 7 -
IN the app VISUAL STUDIO CODE, please complete the following.
Without changing the makefile:
flags stdcWall I
timeofday.o : timeofday.cpp timeofday.h
g$flagsc $I
testtimeofday : testtimeofday.cpp timeofday.o
g$flags$o $@
checkit : checkit.cpp
g$flags$o $@
checktimeofday : testtimeofday checkit correcttesttimeofday.txt
testtimeofday studenttesttimeofday.txt
checkit
timeinterval.o : timeinterval.cpp timeinterval.h timeofday.h
g$flagsc $I
testtimeinterval : testtimeinterval.cpp timeinterval.o timeofday.o
g$flags$o $@
checktimeinterval : testtimeinterval checkit correcttesttimeinterval.txt
testtimeinterval studenttesttimeinterval.txt
checkit
Task:
Create a TimeOfDay class that holds the hour, minute, and second of a time of day in private integer data members. The class will contain a constructor, a print function, and accessor and mutator functions for the private data members. Read the comments in the supplied timeofday.h header file for more detailed requirements. Initial tests for the functionality of the TimeOfDay class have been provided in the attached testtimeofday.cpp source file. If you place all of the attached files in the same directory, you can run the initial tests with command make checktimeofday. You are encouraged to create more rigorous tests. Create a TimeInterval class that has a start TimeOfDay object and an end TimeOfDay object as private data members. The class will include three constructors, a print function, and accessor and mutator functions for the private data members. Read the comments in the supplied timeinterval.h header file for more detailed requirements. Initial tests for the functionality of the TimeInterval class have been provided in the attached testtimeinteral.cpp source file. If you place all of the attached files in the same directory, you can run the initial tests with command make checktimeinterval. You are strongly encouraged to create more rigorous tests. Specifications Add all code for the definition of the TimeOfDay class to the attached timeofday.h header file. Include all of the necessary code for the TimeOfDay class, including the implementation of all of the public member functions, in the attached timeofday.cpp source file. Add all code for the definition of the TimeInterval class to the attached timeinterval.h header file.
timeofday.h: Define a TimeOfDay class that has private integer data members for the
The class should ensure that the data members always remain in a consistent
state.
Add a constructor to allow the user to initialize the hour, minute,
and second, in that order, with default arguments of
If an argument value is invalid, the corresponding data member should be
initialized to zero. For example, TimeOfDay should initialize
the hour to the minute to and the second to
Add mutator functions SetHour, SetMinute, and SetSecond that set the
data member if the argument is valid, and leave the data member unchanged
if the argument is invalid.
Add accessor functions GetHour, GetMinute, and GetSecond that return
a copy of the value of the corresponding data member.
Add a Print function that will output the TimeOfDay object to the standard
output device using cout, ending with endl to flush the output buffer and
go to the next line
The Print function should take two bool parameters for whether or not to
display the time in military time ie hour format and whether or
not to display the seconds value.
Both parameters should have default arguments of false.
If the first argument is true, the time should print in military time
hour format and if the first argument is false, the time should print
in ampm format.
For example :: in military time is equivalent to :: pm
and :: in military time is equivalent to :: am
If the second argument is true, the output should display the seconds
value and if the second argument is false, the output should omit drop
dont round the seconds component of the time.
eg Print output will be formated as hh:mm am or hh:mm pm
Printtrue output will be formated as hh:mm
Printtrue true output will be formated as hh:mm:ss
Printfalse true output will be formatted as
hh:mm:ss am or hh:mm:ss pm
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
