Answer:
import java.util.Scanner;
public class ShippingCost {
public static void main(String[] args) {
final int FLAT_FEE_CENTS = 75;
final int CENTS_PER_POUND = 25;
Scanner in = new Scanner(System.in);
System.out.println("Please enter the weight of the package");
double shipWeightPounds = in.nextDouble();
double shipCostCents = (CENTS_PER_POUND*shipWeightPounds)+ FLAT_FEE_CENTS;
System.out.println("The Total Shipping cost of the package in cents is "+ shipCostCents);
}
}
Explanation:
In Java language, the two given constants are declared using Java's final keyword indicating a constant value. The Scanner class is used to prompt and receive users' input for the weight of the shipment. The value is stored as shipWeightPounds. Understanding that shipping costs 25 cents per pound in addition to the flat rate of 75 cents, this statement,
shipCostCents = (CENTS_PER_POUND*shipWeightPounds)+ FLAT_FEE_CENTS;
Computes the cost of the entire package.