5. A cloth showroom announced the following festival discounts on the purchase of items,
based on the total cost of the items purchased:
Total cost (in )
Discount
0-1000
No discount
1001-2000
5%
2001-5000
10%
>5000
15%
Write a program in BASIC to input the total cost of the items purchased and calculate
the final amount to be paid after availing the discount.
[E
Answers
Answer:
import java.io.*;
class Discount_Showroom
{
public static void main(String args[])throws IOException
{
InputStreamReader in=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(in);
System.out.println("Please Enter the total cost");
int cost=Integer.parseInt(br.readLine());
if (cost<2000)
{ int a= cost*5/100;
int b=cost-a;
System.out.println("Please pay "+b);
}
else if (cost>2000&&cost<=5000)
{
int a=cost*25/100;
int b=cost-a;
System.out.println("Please pay "+b);
}
else if (cost>5000&&cost<=10000)
{
int a=cost*35/100;
int b=cost-a;
System.out.println("Please pay "+b);
}
else
{ int a=cost*50/100;
int b=cost-a;
System.out.println("Please pay "+b);
}
System.out.println("Thank You,Please Visit Again");
}
}
INPUT "ENTER THE AMOUNT: ";A
IF A<1001 THEN
PRINT "THE AMOUNT TO BE PAID = ";A
ELSE IF A>1000 AND A<2001 THEN
PRINT "AMOUNT TO BE PAID = ";A+(A/100*5)
ELSE IF A>2000 AND A<5001 THEN
PRINT "AMOUNT TO BE PAID = ";A+(A/100*10)
ELSE
PRINT "AMOUNT TO BE PAID = ";A+(A/100*15)
END IF
END