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...
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.
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.
PLEASE CREATE A PROGRAM IN PSEUDOCODE AND C# Back in my Day!  Kids who grew up in...
PLEASE CREATE A PROGRAM IN PSEUDOCODE AND C# Back in my Day!  Kids who grew up in the late 70s didn’t have a lot of options for video games, but they did have “Choose your own Adventure” books.  These books were cool and let the reader make meaningful decisions.  If they chose choice “A”, they would turn to a page of the book and continue their adventure.  If they chose choice “B”, they would turn to a different page and read a different adventure.  Your...
C++ Program for Project Alarm. ------------------------------------------------------------------------------ Fix ALL Errors in my EXISTING code for ALL 5...
C++ Program for Project Alarm. ------------------------------------------------------------------------------ Fix ALL Errors in my EXISTING code for ALL 5 files.   MUST add comments for FULL CREDIT. Take a screenshot of the working solution output. ------------------------------------------------------------------------------- Instructions: Use class composition to define and implement a new class called Alarm that contains a Time member variable. A. Define and implement the class Alarm as follows: The class Alarm consists of two private member variables: description of type string and atime of type Time. The class...
C++ How do I initialize a clock to 0 and run it constantly throughout the program?...
C++ How do I initialize a clock to 0 and run it constantly throughout the program? THEN, how do I get the time at that moment multiple times? As in id like to set the clock = 0, do stuff do stuff get time now, store it do stuff get time now, store it then also be able to do arithmetic on it, for instance, last time - current time = 2 seconds. I made it sound complicated but I...
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.
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT