Aling Nena Store
Aling Nena Store
Exercises;
import java.util.*;
import java.lang.*;
System.out.print("Product: ");
String Product = kbd.nextLine();
System.out.print("quantity: ");
int quantity = Integer.parseInt(kbd.nextLine());
System.out.print("Unit price: ");
double Unitprice = Float.parseFloat(kbd.nextLine());
System.out.print("Discount: ");
double discount = Float.parseFloat(kbd.nextLine());
System.out.print( "Cash Tendered: ");
double cashTendered = Float.parseFloat(kbd.nextLine());
System.out.println();
double totalPurchaseAmount;
totalPurchaseAmount = quantity * Unitprice;
System.out.printf("\nTotal Purchase amount: %.2f", totalPurchaseAmount);
double totalDiscount;
totalDiscount = totalPurchaseAmount * discount /100;
System.out.printf("\nTotal Discount: %.2f", totalDiscount);
double amountToBePaid;
amountToBePaid = totalPurchaseAmount-totalDiscount;
System.out.printf("\nAmount to be paid: %.2f", amountToBePaid);
double Change;
Change = cashTendered - amountToBePaid;
System.out.printf("\nChange: %.2f", Change);
}
}