Traffic Light Simulator

#include <iostream>
#include <cmath>
#include <chrono>
#include <thread>
 
int main()
{
    // caleb b
    // simulating a traffic light
    int lightState = 0; // 0 = red, 1 = yellow, 2 = green
    bool run = true;
    while(run) {
        if (lightState == 0) {
            std::cout << "Red light" << std::endl;
            std::this_thread::sleep_for(std::chrono::seconds(30));
            lightState = 2;
        } else if (lightState == 1) {
            std::cout << "Yellow light" << std::endl;
            std::this_thread::sleep_for(std::chrono::seconds(3));
            lightState = 0;
        } else if (lightState == 2) {
            std::cout << "Green light" << std::endl;
            std::this_thread::sleep_for(std::chrono::seconds(15));
            lightState = 1;
        }
    }
}

Coffee Shop Ordering System

#include <iostream>
#include <cmath>
#include <chrono>
#include <thread>
 
int main()
{
    // caleb b
    // coffee shop ordering system
 
    int choice;
    std::cout << "Which drink would you like?:" << std::endl;
    std::cout << "1. Espresso" << std::endl;
    std::cout << "2. Latte" << std::endl;
    std::cout << "3. Cappuccino" << std::endl;
 
    std::cin >> choice;
 
    switch(choice) {
        case 1:
            std::cout << "Preparing your Espresso" << std::endl;
            std::this_thread::sleep_for(std::chrono::seconds(10));
            std::cout << "Your Espresso is ready!" << std::endl;
            break;
        case 2:
            std::cout << "Preparing your Latte" << std::endl;
            std::this_thread::sleep_for(std::chrono::seconds(15));
            std::cout << "Your Latte is ready!" << std::endl;
            break;
        case 3:
            std::cout << "Preparing your Cappuccino" << std::endl;
            std::this_thread::sleep_for(std::chrono::seconds(20));
            std::cout << "Your Cappuccino is ready!" << std::endl;
            break;
    }
}