Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Question: Make a stopwatch class that will record elapsed duration between calls to start and stop. This class will also cleanly display the relevant

C++ Question:

Make a stopwatch class that will record elapsed duration between calls to start and stop. This class will also cleanly display the relevant information to the user.

This class must implement:

  • start() a method for setting the start of the stop watch
  • stop() a method for stopping the watch
  • getElapsedTime() a method that returns the elapsed time between start and stop in seconds
  • printWatch() a method that will output to the terminal the current status of the watch

Look over in particular clock() as a way to measure time.

The test program can be based on user input (time between entries) and/or amount of time it takes to execute a portion of code. If user input, create three stopwatches: One that starts when the program begins and stops when the program is about to end and two that are set by waiting on the user. The total time from the two user-based stopwatches should relate to the total elapsed time of the first stopwatch. If you are going to time portions of code, you are going to need to test code that takes at least 10 seconds to run, and you should be able to show that using different parameters results in different time.

Implement a stopwatch accurate down to the millisecond. It will need to report time in both seconds and milliseconds (probably as two different methods)

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

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago