make a java program by seeing the photo.
Answers
import java.util.Scanner;
public class prog
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter weight of parcel: ");
double wt = in.nextDouble();
System.out.print("Enter type of booking: ");
char type = in.next().charAt(0);
double charge = 0;
if (wt <= 0)
charge = 0;
else if (wt <= 100 && type == 'O')
charge = 80;
else if (wt <= 100 && type == 'E')
charge = 100;
else if (wt <= 500 && type == 'O')
charge = 150;
else if (wt <= 500 && type == 'E')
charge = 200;
else if (wt <= 1000 && type == 'O')
charge = 210;
else if (wt <= 1000 && type == 'E')
charge = 250;
else if (wt > 1000 && type == 'O')
charge = 250;
else if (wt > 1000 && type == 'E')
charge = 300;
System.out.println("Parcel charges = " + charge);
}
}
please mark as brainliest
import java.util.Scanner;
public class parcel
{
public static void main (String args[])
{
Scanner sc = new Scanner (System.in);
System.out.println("Please enter the weight of the parcel");
int weight = sc.nextInt();
System.out.println("Please enter the type of booking");
char type = sc.next().charAt(0);
if (weight <= 100 && weight > 0)
{
if (type == 'o' || type == 'O')
{
int charge = 50;
System.out.println("Total : "+charge);
}
else if (type == 'e' || type == 'E')
{
int charge = 80;
System.out.println("Total : "+charge);
}
else
{
System.out.println("Zero");
}
}
else if (weight <= 500 && weight > 100)
{
if (type == 'o' || type == 'O')
{
int charge = weight/100 * 40;
System.out.println("Total : "+charge);
}
else if (type == 'e' || type == 'E')
{
int charge = weight/100 * 70;
System.out.println("Total : "+charge);
}
}
else if (weight > 500)
{
if (type == 'o' || type == 'O')
{
int charge = weight/100 * 35;
System.out.println("Total : "+charge);
}
else if (type == 'e' || type == 'E')
{
int charge = weight/100 * 65;
System.out.println("Total : "+charge);
}
}
sc.close();
}
}