1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Yakvenalex [24]
3 years ago
5

Java languageThe 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); }}

Computers and Technology
2 answers:
Sophie [7]3 years ago
8 0

Answer:

// Here is code in Java.

// import package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

    try{

   // variables

    final int CENTS_PER_POUND = 25;

    final int FLAT_FEE_CENTS = 75;

    // Scanner object to read input

   Scanner sr=new Scanner(System.in);

   System.out.print("Enter the shipping weight:");

   // read the input weight

   int shipWeightPounds=sr.nextInt();

   // calculate total cost

  int shipCostCents = (shipWeightPounds * CENTS_PER_POUND) + FLAT_FEE_CENTS;

  // print Weight

  System.out.println("shipping  Weight: " + shipWeightPounds);

  // print flat fee

     System.out.println("flat fee of shipping in cents : " + FLAT_FEE_CENTS);

     // print cents per round

     System.out.println("Cents/pound for shipping: " + CENTS_PER_POUND);

     // print cost of Shipping

    System.out.println("total cost of shipping in cents: " + shipCostCents);

   

   

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize two constant variables "CENTS_PER_POUND=25" & "FLAT_FEE_CENTS = 75". Read the input weight from user with the help of Scanner class object. Then  calculate the cost of shipping by multiply weight with cent per pound and add flat fee. Then print each of them.

Output:

Enter the shipping weight:12                                                                                                                                  

shipping  Weight : 12                                                                                                                                        

flat fee of shipping in cents: 75                                                                                                                              

Cents/pound for shipping: 25                                                                                                                                  

total cost of shipping in cents: 375  

zhuklara [117]3 years ago
3 0

Answer:

final int CENTS_PER_POUND = 25;

     shipWeightPounds=scnr.nextInt();

     shipCostCents = ((shipWeightPounds * CENTS_PER_POUND) + FLAT_FEE_CENTS);

Explanation:

You might be interested in
Which of the following is NOT an algorithm?
Nina [5.8K]
I’m pretty sure it would be “A novel assigned in English class” (algorithm is a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.) Example: the recipe for baking a cake.
3 0
3 years ago
Jennifer’s company currently uses Windows Active Directory to provide centralized authentication, authorization, and accounting
Vsevolod [243]

Answer:

RADIUS

Explanation:

Remote Authentication Dial-In User Service (RADIUS) is a networking protocol that provides centralized Authentication, Authorization, and Accounting management for users connected to a network service. It can be used to authenticate anyone who is on your network.

RADIUS is a protocol that uses TCP or UDP as transport. RADIUS client is what is used to communicate with RADIUS servers at gateways of the network.

8 0
3 years ago
Why would Network Systems employees be employed by the government?
Ghella [55]
Well knowing how the government is with security id go with A. as it makes a lot of sense unlike B and D and if they were looking for software the question would mention it
8 0
3 years ago
Read 2 more answers
What's the main idea??
tatyana61 [14]
My computer wont let me download this pdf

7 0
2 years ago
Only one person can receive the same email at the same time true or false
nasty-shy [4]

Answer:

false

Explanation:

5 0
3 years ago
Other questions:
  • Running fewer applications at once is a way to resolve which type of bottleneck?
    9·1 answer
  • Which statement is true? Group of answer choices Variables cannot be assigned and declared in the same statement Variable names
    5·1 answer
  • What are some good job skills?
    12·1 answer
  • How do I download the Microsoft word on my Hp probook
    8·2 answers
  • Fill in the blank with the letter HTML
    14·1 answer
  • Businesses and sometimes individuals use a _____ to assimilate all of their social media content on a specific topic to engage r
    13·1 answer
  • What Are the Benefits of Using Leads Automation Tool?
    5·1 answer
  • Taking a group of recipes and identifying the similarities is an example of _____.
    13·1 answer
  • Including the word OR will make a search less specific.<br> O False<br> O True
    8·2 answers
  • A bitmap image is provided in two different resolutions. Image 1 has a resolution of 1500 x 1225. Image 2 has a resolution of 50
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!