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
What are the max amount of warnings you get before you get banned?
Olenka [21]

Answer:

I'm not sure but I just got a warning from this person Kaite....

5 0
3 years ago
Read 2 more answers
What is known as networking in the IT field?
Sidana [21]

Answer:

r u Kate tell me plz I love u baby tell me please

4 0
3 years ago
A drawback of using observation as a data collection method is that:_______
melamori03 [73]

Answer:

The answer is d, because it is not reliable in the sense that it can be used for important and sensitive information when your collecting data.

8 0
4 years ago
A(n) ______ disk is a storage device that contains one or more inflexible, circular platters that use magnetic particles to stor
Delvig [45]
Hard






----------------------------------------------
5 0
3 years ago
the hardare components of a computer system interact with each other by using which of the following?
adoni [48]

Answer: ports and system bus

Explanation:

6 0
4 years ago
Other questions:
  • ______ is a process that marks the location of tracks and sectors on a disk.
    6·1 answer
  • Once the technology for the collection of solar power is in place what will be two benefits of its use
    9·1 answer
  • A good place to get hints about how to answer a response question could be a. Your teacher c. Both of these b. The rest of the t
    13·2 answers
  • Keyshia now wants to remove the background of the image. She marks the areas she wants to keep and the areas she wants to remove
    13·2 answers
  • Which solution eliminates the need for dedicated high-speed WAN connections between sites
    11·1 answer
  • In PowerPoint, Jake wants to change the slide background to a photo on his computer. He is walking through a tutorial given to h
    7·1 answer
  • Match the image to the view type in a presentation program. scroll bar tool bar status bar menu bar provides an array of buttons
    10·2 answers
  • Write a script that checks to see if at least one argument has been given on the command line and tests whether the argument is
    5·1 answer
  • Classify computer software and write short note about it ?​
    6·1 answer
  • I wanna be the very best
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!