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
The variety of theatre introduced in the 1960s that denotes semi-professional or even amateur theatre in the New York/Manhattan
antoniya [11.8K]

Answer:

The answer is letter A. TRUE

Explanation:

The variety of theatre introduced in the 1960s that denotes semi-professional or even amateur theatre in the New York/Manhattan area, often in locations such as church basements, YMCAs, and coffeehouses, is commonly known as off-off-Broadway.  This statement is true.

3 0
3 years ago
Rick needs to find the lowest number in a set of numbers that includes decimals. Which statistical function in a spreadsheet wil
professor190 [17]
Umm

I’m in 10th grade so.....what is a spreadsheet and statistical function
4 0
3 years ago
Read 2 more answers
Write all the hexadecimal numbers in sequence from 9F7H to A03H
Harlamova29_29 [7]

Answer:

(9F7, 9F8, 9F9, 9FA, 9FB, 9FC, 9FD, 9FE, 9FF, A00, A01, A02, A03)

Explanation:

(9F7)_{16} =  (2551)_{10}

(A03)_{16} = (2563)_{10}

This means that we must find all hexadecimal values from 2551 to 2563, or 9F7 to A03. You can convert from decimal to hexadecimal for each one, or just count.

5 0
3 years ago
In this unit, you learned how to manipulate numbers and strings, acquire input from the user, perform data manipulations for var
e-lub [12.9K]

Answer:

Sometimes you will tell the CPU to use the main memory, secondary memory, network, or the input/output devices. Digital Computing: It's All ...

4 0
3 years ago
What are strategies that you can use to yield web sites that are relevant to your research topic?
evablogger [386]

Answer: PLEASE MARK BRAINELEIST

Locating Useful Resources

When you chose a paper topic and determined your research questions, you conducted preliminary research to stimulate your thinking. Your research proposal included some general ideas for how to go about your research—for instance, interviewing an expert in the field or analyzing the content of popular magazines. You may even have identified a few potential sources. Now it is time to conduct a more focused, systematic search for informative primary and secondary sources.

5 0
3 years ago
Other questions:
  • You have two LANs connected via a router. Network 1 has a DHCP server with a single Ethernet interface. Network 2 does not have
    9·2 answers
  • Create a function that will perform linear interpolation from a set of measured data stored in a list or array. The function sho
    13·1 answer
  • Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of
    14·1 answer
  • Henry, a graphic artist, wants to create posters. Which software should Henry use for this purpose?
    13·1 answer
  • Does coaxial cable use radio waves to transmit data
    10·2 answers
  • Which type of fiber-optic connector, containing one fiber-optic strand per connector, is connected by pushing the connector into
    7·1 answer
  • Which sentence(s) below are true?a. IP stands for Internet Protocol.b. In most home networks IP addresses are assigned by the In
    6·1 answer
  • cout << "Part 1" << endl; // Part 1 // Enter the statement to print the numbers in index 4 and index 9 // put a spac
    11·1 answer
  • Which of the following are causes of a run-time error. Choose all that apply.
    13·1 answer
  • Henry is creating code In JavaScript to run calculations on extremely small numbers. How can he use MIN_VALUE as validation in t
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!