Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //class work.
- import java.util.Scanner;
- public class number4 {
- public static void main(String[] args) {
- Scanner input = new Scanner (System.in);
- double price, rate;
- System.out.println("Price of Item: ");
- price = input.nextDouble();
- System.out.println("Discount Rate: ");
- rate = input.nextDouble();
- System.out.println("Discounted Price: " +discount(price, rate));
- }
- public static double discount(double price, double rate) {
- double discount, discount_amt;
- discount_amt = price * rate;
- discount = price - discount_amt;
- return discount;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement