Respuesta :
The constants are
FLAT_FEE_CENTS and
CENTS_PER_POUND
Then
shipCostCents = FLAT_FEE_CENTS + CENTS_PER_POUND x shipWeightPounds
The shipping cost in cents is calculated by adding the flat fee and the cost of the package per pound multiplied by the weight of the package.
FLAT_FEE_CENTS and
CENTS_PER_POUND
Then
shipCostCents = FLAT_FEE_CENTS + CENTS_PER_POUND x shipWeightPounds
The shipping cost in cents is calculated by adding the flat fee and the cost of the package per pound multiplied by the weight of the package.
Answer:
First create a Java class namely ShippingCost in which declare the variables shipCostCents and shipWeightPounds and also initialize with the given values. Also, initialize the constant variables CENTS_PER_POUND and FLAT_FEE_CENTS with given values. The cost of ship in cents is equal to sum of flat fee in cents and multiplication of ship weight in pounds and cents per pound.
Further Explanation:
Following is the JAVA code to evaluate the value of cost of ship in cents, weight of ship in pounds, flat fee in cents and total cents per pound.
Code:
import java.util.Scanner;
public class ShippingCost {
public static void main (String [] args) {
//initialize the variables
int shipCostCents = 0;
int shipWeightPounds = 10;
final int CENTS_PER_POUND = 25;
final int FLAT_FEE_CENTS = 75;
shipCostCents = CENTS_PER_POUND * shipWeightPounds + FLAT_FEE_CENTS;
//print the weight of ship in pounds
System.out.println("The weight of the ship in lb: " + shipWeightPounds);
//Print the flat fee in cents
System.out.println("The Flat Fee in cent: " + FLAT_FEE_CENTS);
//print the value of cents per pound
System.out.println("The value of Cents per pound: " + CENTS_PER_POUND);
//print the shipping cost in cents
System.out.println("The value of Shipping cost in cents: " + shipCostCents);
}
Learn more:
1. A company that allows you to license software monthly to use online is an example of ? brainly.com/question/10410011
2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832
3. The shape of our galaxy was determined ‘on the inside looking out' by surveying the milky way using ____________ telescopes. brainly.com/question/7866623
Answer details:
- Grade: College Engineering
- Subject: Computers and Technology
- Chapter: Java Programming
Keywords:
Flat_fee_cents, cents_per_pound, constant, assign, shipCostCents, cost of shipping, package weighing, shipWeightPounds, println, JAVA, C++, Python, system, final, int, class, public, import