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
36
import java.util.*
class Parcel
{ BufferedReader br= new BufferedReader ( new InputStreamReader (System.in));
public void calc()throws IOException
{ double bill,x;
System.out.println("Enter the Weight of the parcel");
x=Double.parseDouble(br.readline());
if (x==1.0)
bill=30
else
bill=30+((x-1)/2)*10;
System.out.println("bill amount:"bill);
}
}
class Parcel
{ BufferedReader br= new BufferedReader ( new InputStreamReader (System.in));
public void calc()throws IOException
{ double bill,x;
System.out.println("Enter the Weight of the parcel");
x=Double.parseDouble(br.readline());
if (x==1.0)
bill=30
else
bill=30+((x-1)/2)*10;
System.out.println("bill amount:"bill);
}
}
Answered by
1
Explanation:
· Weight in Kg Charge per Kg Upto 10 Kgs Rs.25 per Kg Next 20 Kgs Rs.20 per Kg Above 30 Kgs Rs.10 per Kg A ...
Similar questions