Tutorial Task 1.2 - Answers V2
Tutorial Task 1.2 - Answers V2
2
Name:
Student ID:
Pseudocode:
Read the value of appetizer_price
Read the value of main_price
Read the value of dessert_price
total_price = appetizer_price + main_price + dessert_price
Print ‘$’ then the value of total_price to the terminal showing two
decimal places.
Test Data:
First data set Second data set
appetizer_pric 10.30 12.40
e
main_price 34.00 41.00
dessert_price 8.50 9.80
Expected Result:
Now check the actual code produces the output you expected
Do this by completing the missing code in bill_total.rb in Task 1.3 then running the
program.
Here are some terms that may help you: Assignment, evaluate, increment,
1. Using a few sentences explain why it may be important to execute statements in
the correct sequence. (eg: what might happen if the last statement in Program 2
was executed earlier)
5: What sort of types will Ruby use to store the following variables (given the
associated variable values)?
Data Type
See the lesson materials for help with Question 6. You could also see:
https://www.tutorialspoint.com/ruby/ruby_variables.htm