Question: Ultimate Challenge Zero This challenge requires that you do some research on your own into the Ruby programming language. Most of what you need can
Ultimate Challenge Zero
This challenge requires that you do some research on your own into the Ruby programming language. Most of what you need can be found in the Intro to Ruby course notes. You are not expected to read through all these notes. Instead you can skim and search to find the details you require. For question three you will need to do some online research beyond the notes.
Write a Ruby program to calculate the after tax value of a specific dollar amount.
Your program must:
Include a comment block at the top of your file that includes your name.
Store a dollar amount in a variable called "subtotal"
Store the GST rate and PST rate in constants.
Calculate and store the after tax amount in a variable called "grandtotal".
Generate output to the screen in the following format:
Subtotal: $
PST: $
GST: $
Grand Total: $
This output will change when ever you run the program with a new value for subtotal or either of the tax constants.
Note: Don't worry about trailing zeros for now. For example, Ruby will display the float as This is fine.
Update your Ruby program from question one such that it prints a short message after the grand total.
If the grand total is equal to or less than $ then message should be: "Pocket Change"
If the grand total is greater than $ but less than $ the message should be: "Wallet Time"
If the grand total is equal to or greater than $ the message should be: "Charge It
Do some research online to figure out how to read keyboard input from Ruby and how to convert strings into floats.
Currently the subtotal is hardcoded into your program. Update your code so that the user is asked to type in the sub total. Ensure that you convert what they provide into a float before using it in your calculations.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
