A shopkeeper announces two successive discounts 20% and 10% on purchasing of gooods on the marked price. Write a program to input marked price and calculate the selling price of an article
Answers
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.
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);
}
}