Decisions Problems

Problem 1

Write Lua code that asks the user for a number in the range of 1 through 7. Display the corresponding day of the week where

  • 1 for Monday

  • 2 for Tuesday

  • 3 for Wednesday

  • 4 for Thursday

  • 5 for Friday

  • 6 for Saturday

  • 7 for Sunday.

  • If the user enters a number outside the range of 1 - 7, print "error, out of range".

Problem 2

Write Lua code that asks a user for the day of the week in English and translates it to Spanish.

English

Spanish

Sunday

Domingo

Monday

Lunes

Tuesday

Martes

Wednesday

Miercoles

Thursday

Jueves

Friday

Viernes

Saturday

Sabado

If the user enters a word other than the ones above, print "Invalido".

Problem 3

Write Lua code that asks a user to enter a number from 1 through 10. The program should display the Roman numeral version of that number.

Number

Roman Numeral

1

I

2

II

3

III

4

IV

5

V

6

VI

7

VII

8

VIII

9

IX

10

X

Problem 4

Write Lua code that asks a user how much money they spend at the store sale. If they spend less than $75, they receive no discount. If the user spends $75 or more, they receive $15 off. If the user spends $100 or more, they receive $25 off. If they user spends $150 or more, they receive $50 off. Print the total of the order.

Problem 5

Write Lua code that asks a user how much money they spend at the store sale.

  • If the user spends $60 or more, they receive 30% off.

  • If the user spends $50 or more, they receive 25% off.

  • Otherwise, the user will always save 20% off.

Print the total of the order.

‚Äč