Design a class program in cpp to calculate the discount given to a customer on purchasing LED Television. The program also displays the amount paid by the customer after discount. The details are given as: Class name : Television Data members: int cost, int discount, int amount Member functions: Accept( ) : to input the cost of Television Calculate( ) : to calculate the discount Display( ) : to show the discount and the amount paid after discount
Answers
Answered by
2
class Discount
{
public static void main(String args[])
{
double dis,amount,markedprice,s;
markedprice=Double.parseDouble(args[0]);
dis=Double.parseDouble(args[1]);
System.out.println("markedprice= "+markedprint
System.out.println("discount rate="+dis);
s=100-dis;
amount= (s*markedprice)/100;
System.out.println("amount after discount="+amount);
}
}
Similar questions