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; final double CENTS_PER_POUND = 25; shipWeightPounds = scnr.nextDouble(); shipCostCents = FLAT_FEE_CENTS + (CENTS_PER_POUND * shipWeightPounds); 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); } }
Quote: final double CENTS_PER_POUND = 25; shipWeightPounds = scnr.nextDouble();
final int CENTS_PER_POUND = 25; shipWeightPounds = scnr.nextInt();
Quote:What am I missing? I have tried so many ways to solve this.
int shipCostCents = 0; final int FLAT_FEE_CENTS = 75; final double CENTS_PER_POUND = 25;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)