subject

Java language 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.
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=10;
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);
}
}
Screenshot
Testing shipWeightPounds 10
Weight (1b): 10
Flat fee (cents): 75
Cents per pound 25
shipping cost (cents): 325 Your output
× Testing shipWeightPounds-2
Output differs.
Weight (1b) 10
Flat fee (cents): 75
Cents per pound: 25
shipping cost (cents): 325 Your output
Weight (1b) 2
Flat fee (cents): 75
Expected output cents per pound: 25
Shipping cost (cents) 125

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
Ideally, the backrest is tilted back slightly, so when you turn the wheel your shoulders are the seat.
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. this can be done by normalizing to values between 0 and 1, or throwing away outliers. for this program, adjust the values by subtracting the smallest value from all the values. the input begins with an integer indicating the number of integers that follow. ex: if the input is 5 30 50 10 70 65, the output is: 20 40 0 60 55
Answers: 1
question
Computers and Technology, 24.06.2019 21:40
Which of these is not a type of socket? aga (alternating grid array) pga (pin grid array) spga (staggered pin grid array) lga (land grid array)
Answers: 1
You know the right answer?
Java language The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.
1...
Questions
question
Mathematics, 07.01.2021 20:50
question
Mathematics, 07.01.2021 20:50
question
Geography, 07.01.2021 20:50
question
Arts, 07.01.2021 20:50
question
Mathematics, 07.01.2021 20:50
Questions on the website: 13722362