0% found this document useful (0 votes)
62 views1 page

Aling Nena Store

The document contains code for a program that calculates purchase amounts, discounts, amounts due, and change for transactions at a store. It prompts the user to enter a product name, quantity, unit price, discount percentage, and cash tendered. It then calculates the total purchase amount, total discount, amount to be paid, and change and prints out the results.

Uploaded by

Matthew Arceo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views1 page

Aling Nena Store

The document contains code for a program that calculates purchase amounts, discounts, amounts due, and change for transactions at a store. It prompts the user to enter a product name, quantity, unit price, discount percentage, and cash tendered. It then calculates the total purchase amount, total discount, amount to be paid, and change and prints out the results.

Uploaded by

Matthew Arceo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

package Prelim.

Exercises;

import java.util.*;
import java.lang.*;

public class AlingNenaStore {


public static void main(String[] args) {
Scanner kbd = new Scanner(System.in);

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);

}
}

You might also like