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
Midday is a good time to take a portrait outside.<br> true or false?
Over [174]

Answer:

B: False

Explanation:

edg2020

4 0
3 years ago
Wanda wants to find some basic information about her computer, for example, what operating system and how much RAM are installed
Gnoma [55]

Answer:

Its very simple you just need to go on your desktop there right click on Computer/This PC icon and then click on properties. Here you can have all the basic information of the PC including OS version processor and RAM.

6 0
3 years ago
Tara has found a CTSO she’s interested in joining. How can Tara become a member of the CTSO? Tara can become a member of the CTS
Alex787 [66]
I'm not understanding this question, are there any options for the answer?
3 0
3 years ago
Read 2 more answers
.What is a wildcard character? How would you use it to find a record?
7nadin3 [17]

Answer and Explanation:

A wildcard character is a character that can be substituted for either a single character or a string of characters. For instance, in certain operating systems, the asterisk character "*" can be used in lieu of a set of characters, while the character "?" can be used in lieu of a single character.

It is a special character that represents one or more other characters. The most commonly used wildcard characters are the asterisk (*), which typically represents zero or more characters in a string of characters, and the question mark (?), which typically represents any one character.

For example, in searching: run* would mean "any word that starts with 'run' and has any kind of ending." If you entered "run*" at a search engine that offered a wildcard character capability, you would get results for run, runs, running, runner, runners - in short, any possible word that might begin with the three letters.

Use of wildcard character:

Wildcard characters are utilized in customary articulations (a programming type wherein input information is adjusted depending on indicated designs) and in scanning through record catalogs for comparable document names (for instance, if all the work documents on an undertaking start with the characters "F7," you could undoubtedly find all the venture records by just looking for "F7*").  

It is a special case character and is a sort of Meta character .  

In different card games, a wildcard is an assigned card in the deck of cards.

8 0
3 years ago
Why does it still say I am ambitious whenever I have the 5 brainliest and almost 700 points?
Galina-37 [17]
Check below your score it should say something out of 5 you need to get more to get 5/5
8 0
3 years ago
Read 2 more answers
Other questions:
  • In three or four sentences, describe how a person buys and sells stock.
    6·2 answers
  • What type of engine is common on boats designed for shallow water?
    13·1 answer
  • What type of multimedia is a game CD? Game CDs are examples of ___ multimedia.
    15·2 answers
  • A stigma is
    8·2 answers
  • Diagnosing is solving the problem, and trouble shooting is figuring out what the problem is.
    15·1 answer
  • Write a definition of the function printDottedLine, which has no parameters and doesn't return anything. The function prints to
    14·1 answer
  • The section of the browser window highlighted in yellow is the _____.
    11·1 answer
  • 4. You are planning to buy a new couch for your family room. Before you leave for the furniture store, you measure the available
    11·1 answer
  • 1. Write the syntax of the following HTML commands by using any one attribute
    6·2 answers
  • In which cipher method are values rearranged within a block to create the ciphertext?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!