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.
Answers
Answer:
A shopkeeper offers 10% discount on the printed price of digital camera our customer has to pay 6% of GST on remaining amount.
Explanation:
import java.io.*;
public class Q2
{ public static void main(String args[])throws IOException
{
InputStreamReader read =new InputStreamReader(System.in);
BufferedReader in =new BufferedReader(read);
double a;
double dis,ra,st,pa;
System.out.println(“Enter the marked price of the camera”);
a=Double.parseDouble(in.readLine());
dis=30.0/100.0*a;
ra=a-dis;
st=6.0/100.0*a;
pa=ra+st;
System.out.println(“paid amount=”+pa);
}
}
Explanation:
import java.util.*;
public class Tax_Amount
{
public static void main (String args [])
{
Scanner in = new Scanner (System.in);
int d=10, t=6;
double p, dis, amt;
System.out.println("Enter the printed price of the camera: ");
p = in.nextInt();
dis = p - (10/100)*p;
amt = dis + (t/100)*dis;
System.out.println("Printed price of the article = " +p);
System.out.println("Cost price for the customer with the discount given by shopkeeper = " + dis);
System.out.println("Total amount paid by the customer including the tax = " +amt);
}
}