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 10:30
Choose the best explanation for the following statement communication is symbolic
Answers: 3
question
Computers and Technology, 22.06.2019 16:20
Consider the following statements, then select one of the answers below: the signal() function shown below registers "sig_handler()" as the signal handler function for the sigkill signal, without the complexity of using when the sigkill signal is sent to a process running this code, by a user typing "kill -kill ", where the correct process id is used for to target the process, sig_handler() will be executed.
Answers: 1
question
Computers and Technology, 23.06.2019 12:20
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
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, 12.05.2021 17:20
question
Mathematics, 12.05.2021 17:20
question
History, 12.05.2021 17:20
question
Mathematics, 12.05.2021 17:20
question
Arts, 12.05.2021 17:20
Questions on the website: 13722360