Write a java program for North Point Transport company which charges for parcels as per the following tariff:
Weight Charges
Upto 10 Kg Rs. 30 Per Kg
For Next 40 Kg Rs. 25 Per Kg
For Next 50 Kg Rs. 20 Per Kg
Above 100 Kg Rs. 15 Per Kg
Answers
import java.util.Scanner;
public class NPTransport
{
public static void main (String args [])
{
Scanner sc=new Scanner (System.in);
System.out.println("Please Enter The Weight Of The Parcel");
double weight = sc.nextDouble();
if (weight <= 10)
{
double charges = 30.0;
double total = weight * charges ;
System.out.println("Total Amount : "+total);
}
else if (weight <= 50)
{
double charges = 25.0;
double total = weight * charges ;
System.out.println("Total Amount : "+total);
}
else if (weight <= 100)
{
double charges = 20.0;
double total = weight * charges ;
System.out.println("Total Amount : "+total);
}
else if (weight > 100)
{
double charges = 15.0;
double total = weight * charges ;
System.out.println("Total Amount : "+total);
}
sc.close();
}
}