please solve this java program
Answers
import java.util.Scanner;
public class Apex_Transport
{
public static void main (String args [])
{
Scanner sc=new Scanner(System.in);
char city ;
double weight ;
int charges ;
System.out.println("Please Enter The City");
city = sc.next().charAt();
System.out.println();
System.out.print("Please Enter The Weight Of The Parcel : ");
weight = sc.nextDouble();
if (city == 'K' || city == 'k')
{
if (weight <= 100)
{
charges = 45 * weight ;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit(0);
}
else if (weight > 100)
{
charges = 75 * weight;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit(0);
}
}
else if (city == 'M' || city == 'm')
{
if (weight <= 100)
{
charges = 65 * weight ;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit(0);
}
else if (weight > 100)
{
charges = 95 * weight;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit(0);
}
}
else if (city == 'C' || city == 'c')
{
if (weight <= 100)
{
charges = 75 * weight ;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit(0);
}
else if (weight > 100)
{
charges = 115 * weight;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit0);
}
}
else if (city == 'D' || city == 'd')
{
if (weight <= 100)
{
charges = 90 * weight ;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit(0);
}
else if (weight > 100)
{
charges = 125 * weight;
System.out.print(city+"\t"+weight+"\t" +charges);
System.exit(0);
}
}
else
{
System.out.println("Invalid");
System.exit(0);
}
sc.close();
}
}