-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDiscount.java
More file actions
29 lines (23 loc) · 832 Bytes
/
Discount.java
File metadata and controls
29 lines (23 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//Discount.java
//This program calculates the sale price of an item that is regularly
//priced at $59, with a 20 percent discount subtracted.
public class Discount
{
public static void main(String[] args)
{
//Variables to hold the regular price, the amount of a discount
//and the sale price.
double regularPrice = 59.0;
double discount;
double salePrice;
//Calculate the amount of a 20% discount.
discount = regularPrice * 0.2;
//Calculate the sale price by subtracting the discount from the
//regular price.
salePrice = regularPrice - discount;
//Display the results.
System.out.println("Regular Price: $" + regularPrice);
System.out.println("Dicount amount Price: $" + discount);
System.out.println("Sale Price: $" + salePrice);
}
}