Week 15

Source Code

local myName = ""
print("Name: " .. myName)

-- initialize done to false
local done = false

-- sentinel controlled while loop
while not done do
    -- Menu Options
    print("Menu")
    print("E1 - Example 1")
    print("Q - Quit")
    io.write("Choice: ")
    local choice = io.read()

    if choice == "E1" then
        print("Example 1")
        -- add code here


    elseif choice == "E2" then
        print("Example 2")
        -- add code here


    elseif choice == "E3" then
        print("Example 3")
        -- add code here


    elseif choice == "E4" then
        print("Example 4")
        -- add code here

                
    elseif choice == "E5" then
        print("Example 5")
        -- add code here
        

    elseif choice == "E6" then
        print("Example 6")
        -- add code here
        
 
    elseif choice == "E7" then
        print("Example 7")
        -- add code here
        
 
    elseif choice == "E8" then
        print("Example 8")
        -- add code here
        
        
    elseif choice == "E9" then
        print("Example 9")
        -- add code here
        

    -- Q condition
    elseif choice == "Q" then
        print("Quit!")
        done = true
    -- else condition
    else
        print("Invalid choice")
    end
end

w15problem1.lua

print("Problem 1")

w15problem2.lua

print("Problem 2")

w15problem3.lua

print("Problem 3")

w15problem4.lua

print("Problem 4")

w15problem5.lua

print("Problem 5")

w15problem6.lua

print("Problem 6")

w15problem7.lua

print("Problem 7")

w15problem8.lua

print("Problem 8")

w15problem9.lua

print("Problem 9")

Last updated

Was this helpful?