Respuesta :
Answer:
Weight(lb): 10
Flat fee(cents): 75
Cents per pound: 25
Shipping cost(cents): 325
Explanation:
we run this as a jave programming language
import java.util.Scanner;
public class Shipping Calculator {
public static void main (String [] args) {
int shipWeightPounds = 10;
int shipCostCents = 0;
final int FLAT_FEE_CENTS = 75;
final int CENTS_PER_POUND = 25;
shipCostCents = FLAT_FEE_CENTS + CENTS_PER_POUND * shipWeightPound
/* look up the solutioin above */
System.out.println("Weight(lb): " + shipWeightPounds);
System.out.println("Flat fee(cents): " + FLAT_FEE_CENTS);
System.out.println("Cents per pound: " + CENTS_PER_POUND);
System.out.println("Shipping cost(cents): " + shipCostCents);
}
}
Answer:
int CENTS_PER_POUND = 25;
shipWeightPounds = scnr.nextInt();
shipCostCents = (shipWeightPounds * CENTS_PER_POUND) + FLAT_FEE_CENTS;
Explanation:
We declare a constant named CENTS_PER_POUND in the first line of ode as the answer.
scnr.nextInt(); is how we get our imput, then we declare it to shipWeightPounds.
and lastly the math, we get the weight and multiply it by how much the money costs per weight, and then lastly add the flat fee bc its mandatory fee.
Full Code:
import java.util.Scanner;
public class ShippingCalculator {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int shipWeightPounds;
int shipCostCents = 0;
final int FLAT_FEE_CENTS = 75;
int CENTS_PER_POUND = 25;
shipWeightPounds = scnr.nextInt();
shipCostCents = (shipWeightPounds * CENTS_PER_POUND) + FLAT_FEE_CENTS;
System.out.println("Weight(lb): " + shipWeightPounds);
System.out.println("Flat fee(cents): " + FLAT_FEE_CENTS);
System.out.println("Cents per pound: " + CENTS_PER_POUND);
System.out.println("Shipping cost(cents): " + shipCostCents);
}
}