KnowledgeBoat Logo

Computer Applications

A shopkeeper offers 10% discount on the printed price of a mobile phone. However, a customer has to pay 9% GST on the remaining amount. Write a program in Java to calculate the amount to be paid by the customer taking printed price as an input.

Java

Input in Java

54 Likes

Answer

import java.util.Scanner;

public class KboatInvoice
{
    public static void main(String args[]) {
        
        Scanner in = new Scanner(System.in);
        
        System.out.print("Enter the MRP: ");
        double mrp = in.nextDouble();
        
        double priceAfterDiscount = mrp - (0.1 * mrp);
        double priceWithGST = priceAfterDiscount + (priceAfterDiscount * 0.09);
        
        System.out.println("Price after 10% discount and 9% GST: " + priceWithGST);
    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of A shopkeeper offers 10% discount on the printed price of a mobile phone. However, a customer has to pay 9% GST on the remaining amount. Write a program in Java to calculate the amount to be paid by the customer taking printed price as an input.

Answered By

23 Likes


Related Questions