Java Programming Write a program that will calculate the shi

Java Programming

Write a program that will calculate the shipping charge for a package, based on its weight.

You will prompt (either use the Scanner class or JOptionPane) the user to enter the name of the customer, the package ID, and the weight of the package .

Display the customer\'s name, the package id, the weight (in ounces) and the shipping charge ($2.00 / pound) each on separate lines.

Line up the answers vertically using the correct escape characters.

Solution

Program:

public class shipping_cost_for_package
{
public static void main(String[] args)
{
final double oz_per_lb= 16;
double oz=20;
double lbs = (oz/oz_per_lb);
final double price_per_lb =2.00;
double price = (lbs * price_per_lb);
System.out.println(\"Name:Cust Name\");
System.out.println(\"Package ID:998765\");
System.out.println(\"Weight: \" + oz + \" oz\");
System.out.println(\"Shipping Cost\" + price);
}
}

Java Programming Write a program that will calculate the shipping charge for a package, based on its weight. You will prompt (either use the Scanner class or JO

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site