KnowledgeBoat Logo

Computer Applications

A shopkeeper announces two successive discounts 20% and 10% on purchasing of goods on the marked price. Write a program to input marked price and calculate the selling price of an article.

Java

Input in Java

79 Likes

Answer

import java.io.*;

public class KboatSuccessiveDiscount
{
    public static void main(String args[]) throws IOException {
        InputStreamReader read = new InputStreamReader(System.in);
        BufferedReader in = new BufferedReader(read);
        
        System.out.print("Enter marked price: ");
        double mp = Double.parseDouble(in.readLine());
        
        double d1 = mp * 20 / 100.0;
        double amt1 = mp - d1;
        
        double d2 = amt1 * 10 / 100.0;
        double amt2 = amt1 - d2;
        
        System.out.print("Selling Price = " + amt2);
    }
}

Output

BlueJ output of A shopkeeper announces two successive discounts 20% and 10% on purchasing of goods on the marked price. Write a program to input marked price and calculate the selling price of an article.BlueJ output of A shopkeeper announces two successive discounts 20% and 10% on purchasing of goods on the marked price. Write a program to input marked price and calculate the selling price of an article.

Answered By

31 Likes


Related Questions