Question: C + + + 9 . 7 ( Stopwatch ) Design a class named StopWatch. The class contains: Private data fields startTime and endTime with

C+++
9.7
(Stopwatch) Design a class named StopWatch. The class contains:
Private data fields startTime and endTime with get functions.
A no-arg constructor that initializes startTime with the current time.
A function named start that resets the startTime to current time.
A function named stop that sets the endTime to current time.
A function named getElapsedTime that returns the elapsed time for the stopwatch in milliseconds.
Draw the UML diagram for the class. Implement the class. Write a test program that measures the execution time of sorting 100000 numbers using selection sort.
**9.11
(The EvenNumber class) Define the EvenNumber class for representing an even number. The class contains:
A data field value of the int type that represents the integer value stored in the object.
A no-arg constructor that creates an EvenNumber object for the value 0.
A constructor that constructs an EvenNumber object with the specified value.
A function named getValue) to return an int value for this object.
A function named getNext to return an EvenNumber object that represents the next even number after the current even number in this object.
A function named getPrevious to return an EvenNumber object that represents the previous even number before the current even number in this object.
Draw the UML diagram for the class. Implement the class. Write a test program that creates an EvenNumber object for value 16 and invokes the getNext and getPrevious () functions to obtain and display these numbers.
*9.9
(Algebra: 2 X 2 linear equations) Design a class named LinearEquation for a 2 X 2 system of linear equations:
ax + by = e
ed bf
..
ex+ey=f
ad - be
e
ad - be
The class contains:
Private data fields a, b, c, d, e, and f.
A constructor with the arguments for a, b, c, d, e, and f.
Six get functions for a, b, c, d, e, and f.
A function named isSolvable) that returns true if ad - be is not 0.
Functions getX) and getY that return the solution for the equation.
Draw the UML diagram for the class and then implement the class. Write a test program that prompts the user to enter a, b, c, d, e, and f and displays the result.
If ad - be is 0, report that "The equation has no solution." See Programming Exercise 3.3 for sample runs.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!