Respuesta :
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.
The shipping cost ; shipCostCents = FLAT_FEE_CENTS + (shipWeightPounds × CENTS_PER_POUND)
The shipping cost can be calculated thus :
Flat fee + (Weight of package × cost per pound
Using Python 3 :
#Declaring the constant fee per pound = 25 cent
CENTS_PER_POUND = 25
#Takes input from the user, the weight in pounds of the package.
shipWeightPounds = eval(input("Weight of your package"))
FLAT_FEE_CENTS = 75
shipCostCents = FLAT_FEE_CENTS + (shipWeightPounds × CENTS_PER_POUND)
Print(shipCostCents)
Learn more : https://brainly.com/question/19625875?referrer=searchResults