1
1
{
String name;
int w,charge;
void accept() //start of method
{
Scanner sc=new Scanner(System.in); //start of scanner class
System.out.println("Enter name of the customer");
name=sc.nextLine();
System.out.println("Enter the weight of the parcel(in Kg)");
w=sc.nextInt;
}
void calculate() //start of calculate method
{
if(w>=1&&w<=10)
{
charge=w*25;
}
else if(w>10&&w<=30)
{
charge=250+(w-10)*20;
}
else if(w>20)
{
charge=650+(w-30)*10;
}
charge=charge+charge*0.05; //surcharge
}
void print()
{
System.out.println("Name weight bill amount");
System.out.println("name+","w+","+charge");
}
public static void main(String args[]) //start of main method
{
Atransport ob=new Atransport();
ob.accept();
ob.calculate();
ob.print();
}
}