Computer Science, asked by mamtasrivastavashta1, 6 months ago

Hlo frnds good morning....... Plzz ansr this qstn fast it's urgent.....ansr fast..... ​

Attachments:

Answers

Answered by kamalrajatjoshi94
3

Answer:

import java.util.*;

public class Price

{

public static void main(String args[ ])

{

Scanner in=new Scanner(System.in);

int price;

double d=0.0,amt=0.0;

System.out.println("Enter the price of product");

price=in.nextInt();

if(price>30000)

{

d=10.0/100.0*price;

amt=price-d;

}

else if(price>=15000&&price<=30000)

{

d=7.5/100.0*price;

amt=price-d;

}

else if(price<15000&&price>=5000)

{

d=5.5/100.0*price;

amt=price-d;

}

else if(price>0&&price<5000)

{

d=3.0/100.0*price;

amt=price-d;

}

System.out.println("The amount paid by customer="+amt);

}

}

Note:You wrote 50000 which is an invalid input as it is the first condition hence I think it should be 5000 not 50000 Ok hope it helps.........

Similar questions