Input Problems

Problem 1

print("Problem 1")

Write Lua code that asks, "What is your favorite color?". Assign the input to the variable named color.

Print the following statement, "My favorite color is ____" where ____ is the value of the variable color.

Problem 2

print("Problem 2")

Write Lua code that asks, "What town do you live in?". Assign the input to the variable named town.

Print the following statement, "I live in ____" where ____ is the value of the variable town.

Problem 3

print("Problem 3")

Write Lua code that asks, "How many brothers do you have?". Assign the input to the variable named brothers.

Print the following statement, "I have ____ brothers" where ____ is the value of the variable brothers.

Problem 4

print("Problem 4")

Write Lua code that asks, "How many sisters do you have?". Assign the input to the variable named sisters.

Print the following statement, "I have ___ sisters" where ____ is the value of the variable sisters.

Sisters aren't strings

Problem 5

print("Problem 5")

Write Lua

Assign the variable siblings to brothers plus sisters from Problems 3 and 4.

Print the following statement, "I have ____ siblings".

Problem 6

print("Problem 6")

Write Lua code that asks, "What is the length of the rectangle". Assign the input to the variable length. Ask "What is the width of the rectangle". Assign the input to the variable width.

Assign the variable area according to the formula:

Area=lwArea = lw

Assign the variable perimeter according to the formula:

Perimeter=2l+2wPerimeter = 2l + 2w

Print the following statement, "The area of the rectangle is ____" where ____ is the area of the rectangle .

Print the following statement, "The perimeter of the rectangle is ____" where ____ is the perimeter of the rectangle.

Problem 7

print("Problem 7")

Write Lua code that asks, "What is the side of a square". Assign the input to the variable side.

Assign the variable area according to the formula:

Area=s2Area=s^2

Assign the variable perimeter according to the formula.

Perimeter=4sPerimeter=4s

Print the following statement, "The area of the square is ____" where ____ is the area of the square.

Print the following statement, "The perimeter of the square is ____" where ____ is the perimeter of the square.

Problem 8

print("Problem 8")

You plan on getting a summer job at the end of the school year.

Write Lua code that asks, “How much will you make per hour?” Assign the input to the variable rate. Then ask, “How many hours will you work per week?”. Assign the input to the variable hours.

Assign the variable money to the amount of money you’ll make.

Print the following statement, “If I work, I’ll make ____.” where ____ is the amount of money.

Problem 9

print(“Problem 9”)

Write Lua code that asks, "How much data did you use this month in gigs". Assign the input to the variable gigs. Your phone company charges $5 per gig and $20 for talk and text.

Assign the variable total to the total amount of money you’ll owe this month.

Print the following statement, "This month I will owe ____".

Problem 10

print("Problem 10 Part I")

Write Lua code that asks, 'What is the temperature in Fahrenheit'. Assign the input to the variable F.

Assign the variable celsius according to the formula:

celsius=59(F32)celsius = \frac{5}{9} (F-32)

Print the following statement, "The temperature in Celsius is ____."

print("Problem 10 Part II)

Write Lua code that asks, 'What is the temperature in Celsius'. Assign the input to the variable C.

Assign the variable Fahrenheit according to the formula:

fahrenheit=95C+32fahrenheit = \frac{9}{5}C +32

Print the following statement, "The temperature in Fahrenheit is ____."

Problem 11

Write Lua code that asks the user for the length and width of a farmer's field. Display the area of the field in acres. Hint: There are 43,560 square feet in an acre.

Problem 12

Write Lua code that asks the user for the cost of a meal at a restaurant. Use your local sales tax when computing the amount of tax owed. Also, add a 18% tip before sales tax. Print the tax amount, the tip amount and the grand total.