Write a java program.A courier company charges for an Ordinary mail and an Express mail based on the weight of the parcel as per tarrif given below: Wgt of parcel(in.gms) 1)Upto 100gms 2)101 to 500gms 3)501 and above charge on Ordinary mail 1)Rs 50 2)Rs 40/100 gms 3)Rs 35/100gms Charge on express mail 1)Rs 80 2)Rs 70/100gms 3)Rs 65/100gms
Answers
Answer:
Here is your answer
pls mark as the brainliest
Answer:
hope it will help you
see bro this this the correct program
________________________________
import java.util.Scanner;
public class gdrmm
{
public static void main(String args[])
{
int wt,charge,unit=0;
char type;
Scanner in = new Scanner(System.in);
System.out.print("Enter weight of parcel: ");
wt = in.nextInt();
System.out.print("Enter type of booking: ");
type = in.next().charAt(0);
charge = 0;
if(type == 'O')
{
if(wt<=100)
charge=50;
else if(wt>100 && wt<=500)
{ unit =(int)( Math.ceil(wt/100.0));
charge=unit*40;
}
else if(wt>=501 && wt<=1000)
{ unit = (int)(Math.ceil(wt/100.0));
charge=unit*35;
}
}
if(type == 'E')
{
if(wt<=100)
charge=80;
else if(wt>100 && wt<=500)
{ unit = (int)(Math.ceil(wt/100.0));
charge=unit*70;
}
else if(wt>=501 && wt<=1000)
{ unit = (int)(Math.ceil(wt/100.0));
charge=unit*65;
}
}
System.out.print("The type of percel is ; " + type);
System.out.print("The weight of percel is ; " + wt+" gr .");
System.out.print("The type of percel is ; " + charge+" /-");
}
}