Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COSC 1430 - Homework 4: Classes 1- Objective Construction of a class with various features, paired with the use of a dynamic array 2 -

image text in transcribedimage text in transcribedimage text in transcribed

COSC 1430 - Homework 4: Classes 1- Objective Construction of a class with various features, paired with the use of a dynamic array 2 - Problem For this assignment, you will need to turn in 3 files: main.cpp, class.h, and class.cpp. These should be turned in via the server in the same directory named hw4. Your hw4 directory will be copied at 11:59 PM the night the assignment is due. Anything not in the directory at that time will not be accepted 2.1 - Class You will need to make a class named stopwatch with the attributes hour, minute, and second. You need to declare them as private members. Your class will need to contain two constructors, a default that will set the classes attributes to 0, and a constructor that takes three arguments to se t hour, minute and second. 2.2 - Main Program should ask the user how many times they wish to enter and then create a dynamic Your main program array based on that input. The user should then be asked to enter the data for the time objects that will be stored in the array. If the user enters a value outside of the ranges for one or more of the attributes (i.e. negative for hours, negative or>60 values for minutes or seconds), the default constructor should be called. Once the array has been completed, the user should be presented with a menu with three options: 1) Print the Individual Stored Times, 2) Print the Total Time, 3) Exit the Program. In order to perform the first two menu functions you may need to expand your class beyond the earlier mentioned constructors. Specifically, to implement 1), add a new member function, called print time) to print out the time in the format of hh:mm:ss (see the following example output for a demonstration). To implement 2), you need to implement a loop to go over all objects in your dynamic array and sum their

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Define recruitment.

Answered: 1 week ago

Question

Identify external recruitment sources.

Answered: 1 week ago