Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:image text in transcribed

*/ 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

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

Which personal relationships influenced you the most?

Answered: 1 week ago

Question

What were your most important educational experiences?

Answered: 1 week ago

Question

How was your life influenced by those events?

Answered: 1 week ago