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
Answered By
31 Likes
Related Questions
Write a program to calculate the gross salary of an employee when
Basic Salary = Rs.8600
DA = 20% of Salary
HRA = 10% of Salary
CTA = 12% of the Salary.
Gross Salary = (Salary + DA + HRA + CTA)Write a program to accept Principal, Rate and Time. Calculate and display the interest accumulated for the first year, second year and the third year compound annually.
Sample Input:
Principal = ₹5,000, Rate = 10% per annum, Time = 3 yearsSample Output:
Interest for the first year: ₹500
Interest for the second year: ₹550
Interest for the third year: ₹605Write a program to input the temperature in Celsius and convert it into Fahrenheit. If the temperature is more than 98.6 °F then display "Fever" otherwise "Normal".
Write a program to input two unequal numbers. Display the numbers after swapping their values in the variables without using a third variable.
Sample Input: a=23, b= 56
Sample Output: a=56, b=23