Question

In: Computer Science

In c++ Create a program regarding your wake up routine in the morning Alarm clock goes...

In c++
Create a program regarding your wake up routine in the morning
Alarm clock goes off at 8:00AM
You snooze for 5 mins (for loop I believe)
You snooze again for 5 mins
(Sub routines)
1. Brush teeth
2. Get dressed
3. Go to work


In c++, Create a program regarding your wake up routine in the morning as seen below:
Alarm clock goes off at 8:00AM
You snooze for 5 mins (for loop I believe)
You snooze again for 5 mins(option to hit snooze again)
(Sub routines, after you get out of bed)
1. Brush teeth
2. Get dressed
3. eat breakfast
4. Go to work

end program (going to work should trigger program to end)


yes the program should be in c++

Solutions

Expert Solution

#include<iostream>
#include<chrono>
#include<thread>

using namespace std;
using namespace std::chrono;
using namespace std::this_thread;

void alarm(){
    bool snooze = true;
    string s;

    while(snooze){
       cout << "Its 8'o clock already" << endl;
       cout << "Press f to snooze..." << endl;
       //sleep_until(system_clock::now() + seconds(3));
       //uncomment line 16 if you want to add a delay between alarm messages
       if(cin.get() == 'f'){
           snooze = false;
       }
   }
    cout << "Alarm snoozed for 5 mins";
    cout << endl;
}

void brushTeeth(){
    cout << "I'm brushing my teeth" << endl << endl;
    sleep_until(system_clock::now() + seconds(3)); // adds a delay of 3 seconds. You can change the value.
    cout << "I'm done brushing" << endl << endl;
}

void getDressed(){
    cout << "I'm dressing up" << endl << endl;
    sleep_until(system_clock::now() + seconds(3));
    cout << "I'm dressed now" << endl << endl;
}

void eatBreakfast(){
    cout << "I'm eating my breakfast" << endl << endl;
    sleep_until(system_clock::now() + seconds(3));
    cout << "I'm done eating" << endl << endl;
}

void gotoWork(){
    cout << "Going to work!" << endl;
    exit(0); // triggers program to end
}

int main(){
    alarm();
    alarm(); // calling twice as mentioned
    brushTeeth();
    getDressed();
    eatBreakfast();
    gotoWork();

}


Related Solutions

create a digital alarm clock using multisim software
create a digital alarm clock using multisim software
You wake up one morning and find yourself in a room with Ren and Stimpy. You...
You wake up one morning and find yourself in a room with Ren and Stimpy. You are not sure how you got there but that is irrelevant for the problem. Ren and Stimpy each have an allocation of pizza and beer. You obtain the following information through a pleasant, yet somewhat strange, conversation. Ren will trade two pizzas for one six-pack of beer and be equally happy. At the same time, Stimpy will gladly exchange six pizzas for two of...
Write a program in c++ to do the following: 2. Create an array to hold up...
Write a program in c++ to do the following: 2. Create an array to hold up to 20 integers. 3. Create a data file or download attached text file (twenty_numbers.txt) that contains UP TO 20 integers. 4. Request the input and output file names from the user. Open the files being sure to check the file state. 5. Request from the user HOW MANY numbers to read from the data file, up to twenty. Request the number until the user...
MUST BE DONE IN C (NOT C++) Your create a program that can implement the cases...
MUST BE DONE IN C (NOT C++) Your create a program that can implement the cases in which the initial unit is Fahrenheit or something not recognizable. Your program should incorporate Fahrenheit to Celsius, Fahrenheit to Kelvin and unknown initial units (display an error message for this last one). You must use functions to calculate Fahrenheit degrees.
Use the ListInterface operations only to create a tackPunct routine in C++ that will take a...
Use the ListInterface operations only to create a tackPunct routine in C++ that will take a list of string (array or linked, your choice) as a reference. Use the list operations on the passed list to make all items that don’t have a ‘.’, ‘?’ or ‘!’ have a ‘.’ tacked on.
write a C++ program to CREATE A CLASS EMPLOYEE WITH YOUR CHOICE OF ATTRIBUTES AND FUNCTIONS...
write a C++ program to CREATE A CLASS EMPLOYEE WITH YOUR CHOICE OF ATTRIBUTES AND FUNCTIONS COVERING THE FOLLOWING POINTS: 1) COUNTING NUMBER OF OBJECTS CREATED ( NO OBJECT ARRAY TO BE USED) USING ROLE OF STATIC MEMBER 2) SHOWING THE VALID INVALID STATEMENTS IN CASE OF STATIC MEMBER WITH NON STATIC MEMBER FUNCTION, NON STATIC MEMBERS OF CLASS WITH STATIC MEMBER FUNCTION, BOTH STATIC. SHOW THE ERRORS WHERE STATEMENTS ARE INVALID. 3) CALL OF STATIC MEMBER FUNCTION, DECLARATION OF...
IN C LANGUAGE ONLY PLEASE! First Program: create branchloop.c file Content of the program Enter your...
IN C LANGUAGE ONLY PLEASE! First Program: create branchloop.c file Content of the program Enter your name while running your program as you did with hello2.c (using argc and argv) name has to be 2 words max (e.g. Jose Lopez, Maria Rodrigues) . Make sure to check properly. Print your name 10 times using a loop. 10 is a fixed number. Count how many characters are in your first name and last name. If the number of characters of your...
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create...
C++ program using Eclipse IDE The C++ program should have concurrency. The C++ program should create 2 threads that will act as counters. One thread should count down from 5 to 0. Once that thread reaches 0, then a second thread should be used to count up to 20.
Modify the DetailedClockPane.java class in your detailed clock program, to add animation to this class. Be...
Modify the DetailedClockPane.java class in your detailed clock program, to add animation to this class. Be sure to include start() and stop() methods to start and stop the clock, respectively.Then write a program that lets the user control the clock with the start and stop buttons.
In C Program #include Create a C program that calculates the gross and net pay given...
In C Program #include Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage. The program should compile without any errors or warnings (e.g., syntax errors) The program should not contain logical errors such as subtracting values when you meant to add (e.g., logical errors) The program should not crash when running (e.g., runtime errors) When you run the program, the output should look like this: Hours per Week:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT