Project #48012 - CMPR 120 INTRO PROGRAMMING (c++)

Homework #9

Due Wednesday, November 19

Implement a class that represents a stopwatch. It should provide the following interface:

·         Constructor (no parameters) which initializes private class variables.

·         Modifier toggle() that starts/stops the stopwatch.

·         Modifier reset() that stops the stopwatch (if it is running) and clears the elapsed time.

·         Status split() that returns the current elapsed time, in seconds.

·         Status isRunning() that indicates whether or not elapsed time is currently accumulating.

The stopwatch class should do no console input or output. There should be testing (or user interface) functions that input instructions from the user, interact with a stopwatch object, and report the results to the user. The testing code should handle up to 10 instructions.

For timing, you will need to include the library <time.h>. This will provide two things:

·         A definition of  the data type time_t, which is basically an integer that cannot be negative.

·         The following function prototype: time_t time(int);
time(0) will return the number of seconds from a time long ago. You can obtain the number of seconds between two times by calling time(0) at each time and calculating their difference. For example: time_t startTime = time(0); // then wait a while
time_t endTime = time(0); time_t elapsedTime = endTime–startTime;

The executable program Gold09.exe demonstrates what your program should do.

You should turn in (in a pocket folder): This assignment/grading sheet (write your name in the space below), your statement of completeness, a structure chart corresponding to testing/user-interface functions in your code, and printouts of all interface (.h) and implementation (.cpp) files in your project. All documents should be appropriately labeled.  You should also place a folder containing your interface and implementation files into the private folder of your FTP site.

Grading Sheet, Homework #9

Name: ________________________________

Criteria                                                                Possible          Achieved

Statement of Completeness                                      5                ________

Structure Chart of your user interface                      5                ________

Clear Indentation and Spacing                                 5                ________

Internal Code Comments                                          5                ________

Appropriate Use of Variables                                   5                ________

Appropriate Use of Statements & Expressions        5                ________

Appropriate Use of Functions and Classes             10                ________

Complete/No Errors                                                  5                ________

Output Format and Correctness                               5                ________

Presentation                                                              3                ________

Total:                                                                       53                ________



Subject Computer
Due By (Pacific Time) 11/18/2014 09:00 pm
Report DMCA

Chat Now!

out of 1971 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 1164 reviews

Chat Now!

out of 721 reviews

Chat Now!

out of 1600 reviews

Chat Now!

out of 770 reviews

Chat Now!

out of 766 reviews

Chat Now!

out of 680 reviews
All Rights Reserved. Copyright by - Copyright Policy