Lab 2: (10 Points)
Objective:
The purpose of this lab is to get used to working with classes as well as using program control flow to control the execution of a program.
Practical
The students will be expected to create a simple alarm clock program that will have the following:
- The program must have three different types of clocks
- Alarm after a specified time has passed (ie. in 30 minutes)
- Alarm at a specified time (ie. at 6:00 PM)
- Countdown timer for a specified amount of time (ie. 1 minute)
- The program must make sure the user has input a valid choice
- The program must use at least one do loop, one while loop, and one if statement
- The program must print the current time or countdown
Hint:
- Use the cstdlib library
- Then you can use the code: system("cls"); to clear the console
- The program must let the user know the alarm has gone off
Here is an example output of the program:
Would you like to enter a time, amount of time passed, or a countdown? (time, passed, countdown)
Wrong
I'm sorry that input is incorrect
Would you like to enter a time, amount of time passed, or a countdown? (time, passed, countdown)
countdown
What would you like to countdown from? (H M S)
5 2
I'm sorry that input is incorrect
What would you like to countdown from? (H M S)
0 0 5
Countdown Started!
5
4
3
2
1
FINISHED!
You must print and turn in your .cpp file after showing the instructor
that your program runs.
Grading
This lab is out of 10 points:
- (1 point) Your name must appear at the top of the file
- (1 point) A small description of the program should appear in block
comment at the top of the file
- (1 point) There should be at least 5 line comments in your code
- (3 point) The code should compile
- (4 point) The code should execute correctly
- (1-5 point ec) Various additional formatting or functionality
Included Files
You will need the following files in order to write the program