Answer to Question #210204 in Java | JSP | JSF for ofosu gideon

Question #210204

Management of Goodwill Pharmacy have approached your group to develop an application that prints receipts of Medication purchased by customers. Write a JAVA program to generate a receipt [using the sample below] for the medication sold as Goodwill Pharmacy.

The application should;

i.                    accept as inputs the ITEM(S), QUANTITY, DISCOUNT, UNIT PRICE, TOTAL, TAX RATE, VAT, NET VALUE, and CASH PAID.

ii.                  calculate TOTAL AMOUNT, BILL TOTAL, BALANCE

iii.     

display the ITEM(S), QUANTITY, DISCOUNT, UNIT PRICE, TOTAL, TAX RATE, VAT, NET VALUE, TOTAL AMOUNT, BILL TOTAL, BALANCE, and CASH PAID [using the sample below].

1
Expert's answer
2021-06-24T03:35:16-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("Item(s): ");
        String item = in.nextLine();
        System.out.print("Quantity: ");
        int quantity = Integer.parseInt(in.nextLine());
        System.out.print("Discount: ");
        double discount = Double.parseDouble(in.nextLine());
        System.out.print("Unit price: ");
        double unitPrice = Double.parseDouble(in.nextLine());
        System.out.print("Total: ");
        double total = Double.parseDouble(in.nextLine());
        System.out.print("Tax rate: ");
        double taxRate = Double.parseDouble(in.nextLine());
        System.out.print("VAT: ");
        double vat = Double.parseDouble(in.nextLine());
        System.out.print("Net value: ");
        double netValue = Double.parseDouble(in.nextLine());
        System.out.print("Cash paid: ");
        double cashPaid = Double.parseDouble(in.nextLine());

        System.out.println("Item(s): " + item);
        System.out.println("Quantity: " + quantity);
        System.out.println("Discount: " + discount);
        System.out.println("Unit price: " + unitPrice);
        System.out.println("Total: " + total);
        System.out.println("Tax rate: " + taxRate);
        System.out.println("VAT: " + vat);
        System.out.println("Net value: " + netValue);
        System.out.println("Cash paid: " + cashPaid);
        System.out.println("Total amount: " + total);
        total -= (total * (discount / 100));
        total += (total * (vat / 100));
        total += (total * (taxRate / 100));
        System.out.println("Bill total: " + total);
        System.out.println("Balance: " + (cashPaid - total));
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS