Computers and Technology

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

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:00, seddy86
Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". any value that is the same as the immediately preceding value is considered a consecutive duplicate. in this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. note that the last 3 is not a consecutive duplicate because it was preceded by a 7. write some code that uses a loop to read such a sequence of non-negative integers , terminated by a negative number. when the code finishes executing, the number of consecutive duplicates encountered is printed. in this case, 3 would be printed. assume the availability of a variable, stdin, that references a scanner object associated with standard input. that is, stdin = new scanner(system. in); is given.
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, Jana1517
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i. e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
image
Computers and Technology, 23.06.2019 15:10, cathyjuan
What role did women fill during world war ii?
Answers: 1
image
Computers and Technology, 24.06.2019 14:30, danielweldon1234
When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being displayed?
Answers: 1
Do you know the correct answer?
Java language The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.
1...

Questions in other subjects:

Konu
English, 11.03.2021 02:00
Konu
Mathematics, 11.03.2021 02:00