KnowledgeBoat Logo

Computer Applications

A shopkeeper offers 10% discount on the printed price of a Digital Camera. However, a customer has to pay 6% 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

350 Likes

Answer

import java.util.Scanner;

public class KboatCameraPrice
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter printed price of Digital Camera:");
        double mrp = in.nextDouble();
        double disc = mrp * 10 / 100.0;
        double price = mrp - disc;
        double gst = price * 6 / 100.0;
        price += gst;
        System.out.println("Amount to be paid: " + price);
    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of A shopkeeper offers 10% discount on the printed price of a Digital Camera. However, a customer has to pay 6% 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

137 Likes


Related Questions