answer.
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]
1 year 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]1 year 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]1 year 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
Peter took a selfie in his room. He was a wearing a light blue shirt. But he failed to realize that that shirt would clash in co
Leto [7]

Answer:

A wand tool is to do that in an editing software.

7 0
1 year ago
Read 2 more answers
Sarah is creating and formatting a newsletter for her school. Which page layout rules should she consider when doing this?
lorasvet [3.4K]
Hey!

I believe the answer to 1. Should be A. Rule of Thirds.
6 0
2 years ago
Read 2 more answers
Write a second constructor as indicated. Sample output: User1: Minutes: 0, Messages: 0 User2: Minutes: 1000, Messages: 5000
Mashcka [7]

Complete Question:

Write a second constructor as indicated. Sample output:User1: Minutes: 0, Messages: 0User2: Minutes: 1000, Messages: 5000// ===== Code from file PhonePlan.java =====public class PhonePlan { private int freeMinutes; private int freeMessages; public PhonePlan() { freeMinutes = 0; freeMessages = 0; } // FIXME: Create a second constructor with numMinutes and numMessages parameters. /* Your solution goes here */ public void print() { System.out.println("Minutes: " + freeMinutes + ", Messages: " + freeMessages); return; }}

Answer:

The second constructor is given as:

//This defines the constructor, the name has to be the same as the class //name

PhonePlan(int numOfMinutes, int numberOfMessages) {

this.freeMinutes = numOfMinutes;

this.freeMessages = numberOfMessages

}

Explanation:

The second constructor is defined using java programming language.

  1. The given class has two constructors This is called "Constructor Overloading) which implements polymophism
  2. In the second constructor that we created, we pass in two arguments of type integer numOfMinutes and numberOfMessages.
  3. In the constructor's body we assign these values to the initially declared variables freeMinutes and freeMessages
6 0
1 year ago
While adding voices to an animation, what kind of room should you choose?
MrRissso [65]

Answer:

A. A quiet room

Explanation:

Because if you open the windows the will be noise

a huge room will echoe

a room with air conditioning will make noise

7 0
2 years ago
Assume there is a class AirConditioner that supports the following behaviors: turning the air conditioner on and off. The follow
Dafna11 [192]

Answer:

1)

officeAC = new AirConditioner();

officeAC.turnOn();

2)

officeAC = new AirConditioner();

officeAC.turnOn();

officeAC.setTemp(69);  

Explanation:

1)

In the first statement a new object of the class AirConditioner whose reference is assigned to the officeAC. new is a keyword which creates an object of the class.

Next statement uses the method turnOn(). Reference to the new object officeAC is used to invoke this method turnOn().

2) The first two statements works the same as in 1)

The last statement invokes a method setTemp() using the reference variable and passes the value 69 to this method to set the desired temperature.

6 0
1 year ago
Other questions:
  • Write a copy constructor for carcounter that assigns origcarcounter.carcount to the constructed object's carcount. sample output
    15·2 answers
  • A company operates on two types of servers: 2 large servers (L) and 4 smaller servers (S), with a combined total of 64GB RAM. Th
    9·1 answer
  • #Remember that Fibonacci's sequence is a sequence of numbers
    14·1 answer
  • Wendy is an attacker who recently gained access to a vulnerable web server running Microsoft Windows. What command can she use t
    9·1 answer
  • What does the binary odometer show about representing large numbers​
    15·1 answer
  • Java Programming home > 1.14: zylab training: Interleaved input/output Н zyBooks catalog Try submitting it for grading (click
    6·1 answer
  • Create a different version of the program that: Takes a 3-digit number and generates a 6-digit number with the 3-digit number re
    14·1 answer
  • Television broadcasts were originally delivered by using which technology
    14·1 answer
  • If Maya wants to access a view that would control multiple slides within a presentation, which view should she utilize? Master v
    9·1 answer
  • You are having a problem with your Windows computer that is isolated to a single graphics editing program that you use every day
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!