Question: Ruby I am new to Ruby so I am still learning, I have the majority of the program written, just looking for a little help.

Ruby

I am new to Ruby so I am still learning, I have the majority of the program written, just looking for a little help. Below is the parameters of the program.

A software company sells a package that retails for $99. Quantity discounts are given according to the following table.

Quantity Discount

10-19 10% 20-49 15% 50-99 20% 100 or more 25%

Program Input: The program should prompt the user: "Enter the number of packages purchased: "

Program Calculation: The program will calculate the amount of purchase, the discount and the total amount

Program Output: The program will display to the user the amount of purchase, the discount and the total amount. The program should not loop. After the calculation and displaying the output, the program should exit.

The program should next display the Thank you line with the number of software packages followed by a blank line.

The program should also display the amount of purchase, the discount amount, its percentage and the total amount. There should be a dashed line between the discount and the total amount.

The discount percentage should be display as shown above.You should verify that each of the ranges produces the correct result (0%, 10%, 15%, 20%, and 25%).

Your output should look like the sample output and everything should align correctly.

Output example:Ruby I am new to Ruby so I am still learning, I

*/ Here is my code so far. /*

$software_price = 99

puts "Welcome to Daly Software Sales" puts " " print "Please enter the amount you which to purchase: " soft_num = gets.chomp() puts ("Thank you for you order of " + soft_num + " software packages ")

if soft_num = 10 and soft_num =20 and soft_num = 50 and soft_num = 100 discount = 0.25 #code end class GrandTotal

subtotal = soft_num * $software_price discount_total = subtotal * discount total = subtotal - discount_total

puts "Amount of purchase: $" + total.chomp() puts "Discount Amount (" + discount.chomp() + " ): $" + discount_total puts "------------"

puts "Total Amount: $ " + total

Welcome to Daly Software Sales Thank you for your order of 9 software packages. Amount of Purchase: $ 891.00 Discount Amount (0%): 0.00 Total Amount: $ 891.00 Welcome to Daly Software Sales Thank you for your order of 100 software packages. Amount of Purchase: $ 9900.00 Discount Amount (25%): $ 2475.00 Total Amount: $ 7425.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!