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, 23.06.2019 03:00
Jason, samantha, ravi, sheila, and ankit are preparing for an upcoming marathon. each day of the week, they run a certain number of miles and write them into a notebook. at the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. write a program to them analyze their data. your program must contain parallel arrays: an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. furthermore, your program must contain at least the following functions: a function to read and store the runners’ names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (you may assume that the input data is stored in a file and each line of data is in the following form: runnername milesday1 milesday2 milesday3 milesday4 milesday5 milesday6 milesday7.)
Answers: 3
question
Computers and Technology, 24.06.2019 13:00
If you add the following to the query grid in an access query, what is it called? salestaxamt: [salestaxrate]*[totalsale] formula calculated field total calculation
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Consider jasper’s balance sheet. which shows how to calculate jasper’s net worth?
Answers: 1
question
Computers and Technology, 24.06.2019 17:00
Anew author is in the process of negotiating a contract for a new romance novel. the publisher is offering three options. in the first option, the author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. in the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. in the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000. the author has some idea about the number of copies that will be sold and would like to have an estimate of the royal- ties generated under each option. write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold. the program then outputs he royalties under each option and the best option the author could choose. (use appropriate named constants to store the special values such as royalty rates and fixed royalties.
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
Social Studies, 11.10.2020 18:01
question
English, 11.10.2020 18:01
question
Mathematics, 11.10.2020 18:01
question
Biology, 11.10.2020 18:01
question
Mathematics, 11.10.2020 18:01
Questions on the website: 13722360