The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound. 1. Declare a constant named CENTS_PER_POUN

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound. 1. Declare a constant named CENTS_PER_POUN

Post by answerhappygod »

The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.
1. Declare a constant named CENTS_PER_POUND and initialize with 25.
2. Get the shipping weight from user input storing the weight into shipWeightPounds.
3. Using FLAT_FEE_CENTS and CENTS_PER_POUND constants, assign shipCostCents with the cost of shipping a package weighing shipWeightPounds.
The Cost To Ship A Package Is A Flat Fee Of 75 Cents Plus 25 Cents Per Pound 1 Declare A Constant Named Cents Per Poun 1
The Cost To Ship A Package Is A Flat Fee Of 75 Cents Plus 25 Cents Per Pound 1 Declare A Constant Named Cents Per Poun 1 (184.27 KiB) Viewed 51 times
The Cost To Ship A Package Is A Flat Fee Of 75 Cents Plus 25 Cents Per Pound 1 Declare A Constant Named Cents Per Poun 2
The Cost To Ship A Package Is A Flat Fee Of 75 Cents Plus 25 Cents Per Pound 1 Declare A Constant Named Cents Per Poun 2 (153.6 KiB) Viewed 51 times
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;
" /* Your solution goes here */ "
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);
}
}
CHALLENGE ACTIVITY 2.8.1: Using constants in expressions. The cost to ship a package is a flat fee of 75 cents p cents per pound. 1. Declare a constant named CENTS_PER_POUND a initialize with 25. 2. Get the shipping weight from user input storing th into shipWeightPounds. 3. Using FLAT_FEE_CENTS and CENTS_PER_POUN[ constants, assign shipCostCents with the cost of sh package weighing shipWeightPounds. 396146.2628362.qx3zqy7 1 import java.util.Scanner; 2 4 5 3 public class ShippingCalculator { public static void main(String[] al Scanner scnr = new Scanner (Syst int shipWeight Pounds; int shipCost Cents = 0; 6 7 8 final int FLAT_FEE_CENTS = 75; 9 10 /* Your solution goes here */ 11 12 13 System.out.println("Weight (lb): System.out.println("Flat fee(cel System.out.println("Cents System.out.println("Shipping 14 per p co: 15 16 } 17 }

2.8.1: Using constants in expressions. to ship a package is a flat fee of 75 cents plus 25 pound. e a constant named CENTS_PER_POUND and with 25. e shipping weight from user input storing the weight WeightPounds. FLAT_FEE_CENTS and CENTS_PER_POUND s, assign shipCostCents with the cost of shipping a weighing shipWeight Pounds. 362.qx3zqy7 r; ilculator { ain(String[] args) { w Scanner (System.in); inds; ; = 0; :E_CENTS = 75; goes here */ .n("Weight (lb): " + shipWeight Pounds); n("Flat fee (cents): + FLAT_FEE_CENTS); .n("Cents per pound: + CENTS_PER_POUND); .n("Shipping cost (cents): " + shipCostCents);
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply