Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the form below - filling in the fields based on the output of your program. Check it is working correctly, then answer the questions.

Complete the form below - filling in the fields based on the output of your program. Check it is working correctly, then answer the questions.

image text in transcribed

image text in transcribed

Variables have a scope what are two different scopes variables can have in Ruby?

Pseudocode: 1 Read the value of appetizer_price 2 Read the value of main_price 3 Read the value of dessert_price 4 total_price = appetizer_price + main_price + dessert_price Print '\$' then the value of total_price to the terminal showing two decimal places. Test Data: Expected Result: Order the sequence of the input and output as expected Hint: Drag and drop each sentence in the correct order from the input box to the output box. Follow the logic above in the Pseudocode section Fill the boxes in by completing the missing code in bill_total.rb and then run it with the test data above: The values can be found in the test data and expected data First Pass Read the value of appetizer_price 10.30 Read the value of main _price [ Read the value of dessert_prici Calculate the total_price 52.80 Convert to dollars total_price [ 'hint: to convert to the dollar, add the $ sign before the total Output the total "hint: the total should contain the $ sign and the total number Fill this in by completing the missing code in bill_total.rb and then run it with the test data above: Second Pass Read the value of appetizer _price Read the value of main _price 41.00 Read the value of dessert Calculate the total_price Convert to dollars total _price $63.20 thint: to convert to the dollar, add the $ sign before the total Output the total "hint: the total should contain the $ sign and the total number Focus in the following on using the correct computing terminology. Here are some terms that may help you: Assignment, evaluate, increment, 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) The code main_price =10 is an example of which kind of programming statement? This is an ???? statement. What actions does the computer perform when it executes a=a+b ? The computer first ???? Then it ???? How would the value of the variable i change in statement i=i+1 ? The value of I will be ??? What sort of types will Ruby use to store the following variables (given the associated variable values)? Note: possible types include: Integer, String, Float, Boolean A person's name e.g: "Fred Smith" Number of students in a class e.g: 23 The average age of a group of people e.g: 23.5 A temperature in Celsius e.g: 45.7 True or false e.g: 1==2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

Solve each equation. I - xt^ = + - L + x^

Answered: 1 week ago