Write a program using user-defined methods. Write the following methods:
1. getPrice() which asks the user to input the original price of an item.
2. getDiscount() which asks the user to input the discount rate. The method
should return the decimal version of the rate. For example, if the user inputs 25% for
the discount rate, the value returned by getDiscount() would be 0.25
3. calculateDiscount() which returns the amount of discount based on the user’s
input. Parameters for this method would be the original price and the discount rate.
4. calculateSalePrice() which returns the sale price using parameters of original
price and amount of discount.
5. output() method – format the output in the following manner:
Original Price: $200
Discount Rate: 20% (decimal here is not acceptable)
Amount of Discount: $40
Sale Price: $160
Use the following variables and main method()

public static void main (String [] args)
{
double original, rate, discount, salePrice;
original = getPrice();
rate = getDiscount();
discount = caclulateDiscount(original, rate);
salePrice = caclulateSalePrice(original, discount);
output(original, rate, discount, salePrice);
}

Write your methods using these names and handling these arguments for the
parameters of each method. Do not change this main method. Save the program as
Cheaper.java.

Edited 2 Years Ago by wbbb54: i missed a day of class for a doctors appointment an dam totally unaware of whats going on

What do you need help with exactly? Noone would just write the entire thing for you ...

i'm interested in solving this problem but I'm more interested in you being able to solve it and solve similar ones so try something, put what you know together and everyone here will be willing to help you make your code work

This article has been dead for over six months. Start a new discussion instead.