Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have created a C++ program but need assistance to \"This is the program and no

ID: 3692265 • Letter: I

Question

I have created a C++ program but need assistance to "This is the program and not sure how to get the"When the timer reaches zero, it beeps (by sending the alert character, ‘’ to the standard output device)" portion to work and how to get the timer to display "Each output should overwrite the previous value displayed like a real-world timer"

The assignment and code are posted below.

Need to design, implement and test a countdown timer class named Timer. This class mimics a real-world timer by counting off seconds, starting from the initial value. When the timer reaches zero, it beeps (by sending the alert character, ‘’ to the standard output device). Some appropriate operations might be the following: ---- Create a timer instantiating it to a specified number of seconds ---- Start the timer -----Reset the timer to some value When the Start operation is invoked, it should repeatedly decrement and output the current value of the timer approximately every second. To delay the program for one second use a For loop whose body does absolutely nothing : that is its body is the null statement. Experiment with the number of loop iterations to achieve as close to a one-second delay as you can. Display the timer value at the same position in the center of the screen. Each output should overwrite the previous value displayed like a real-world timer. Use proper indentation, appropriate comments, and meaningful identifiers thought the program.

Explanation / Answer

Hi below i have written a simple example code using C++ for countdown timer for your reference,

#include <iostream>

#include <stdio.h>

#include <conio.h>

#include <windows.h>

using namespace std;

int main()

{

int m, s,h;

cout << "A COUNTDOWN TIMER " << endl;

cout << "enter time in hours here" << endl;

cin >> h;

cout << "enter time in minutes here " << endl;

cin >> m;

cout << "enter im in seconds here" << endl;

cin >> s;

cout << "Press any key to start" << endl;

cout << " A COUNTDOWN TIMER" << endl;

cout << "time remaining" << endl;

cout << "hours : " << h << "mins : " << m << " secs : " << s << endl;

for (int hour = h; hour >= 0; hour--)

{

for (int min = m; min >= 0 ; min--)

{

if ( min == 0 && h > 0)

m = 59;

for (int sec = s; sec >= 0; sec--)

{

if ( sec == 0 )

s = 59;

Sleep(1000);

system("cls");

cout << hour << " :hours " << min << " :mins " << sec << " :secs" << endl;

}

}

}

Sleep(1000);

cout << "THE END" << endl;

return 0;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote