Question
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started