Write a java program to calculate charge for sending parcel.
For 1st kg - Rs 30
Thereafter for every 500 gm or its fraction - Rs 10
Answers
Answered by
2
import java.util.Scanner;
class parcel
{
void main()
{
Scanner c=new Scanner(System.in);
System.out.println("enter the weight of your parcel");
Double wt=sc.nextDouble();
if(wt>=1)
System.out.println("the price is RS 30");
else
{
wt=wt-1;
Double price=wt*10*.5+30;
System.out.println("the price is"+price);
}
}
class parcel
{
void main()
{
Scanner c=new Scanner(System.in);
System.out.println("enter the weight of your parcel");
Double wt=sc.nextDouble();
if(wt>=1)
System.out.println("the price is RS 30");
else
{
wt=wt-1;
Double price=wt*10*.5+30;
System.out.println("the price is"+price);
}
}
Answered by
0
import java util scanner
Similar questions