20.A shopkeeper offers“Puja Discount”to his/her customer according to the good spur chased as per given amount. Goods Purchased Discount Upto Rs.1000/- 5% >1000 and upto 2000 10% >2000 upto 3000 15% >3000 20% Write a program in java to calculate the discount for purchase of goods,by customer.
Answers
Answered by
2
import java.util.*;
class Sample{
public static void main(String args[ ])
{
Scanner sc =new Scanner (System.in);
double amt dis;
S.o.pln ("Amount of goods purchased :");
amt=sc.nectDouble( );
if (amt<=1000)
dis=amt*(5.0/100.0);
else if (amt >1000 &&amt<=2000)
dis=amt *(10.0/100.0);
else if (amt>2000&&amt<=3000)
dis=amt*(15.0/100.0);
else
dis=amt*(20.0/100.0);
S.o.pln("Discount="+dis);
}
}
Similar questions