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
arlik [135]
3 years ago
12

For the given program, how many print statements will execute? public static void printShippingCharge(double weight) { if((weigh

t > 0.0) && (weight <= 10.0)){ System.out.println(weight * 0.75); } else if((weight > 10.0) && (weight <= 15.0)) { System.out.println(itemWeight * 0.85); } else if((weight > 15.0) && (weight <= 20.0)) { System.out.println(itemWeight * 0.95); } } public static void main(String args[]) { printShippingCharge(18); printShippingCharge(6); printShippingCharge(25); }
Computers and Technology
1 answer:
Step2247 [10]3 years ago
4 0

CORRECT QUESTION:

For the given program, how many print statements will execute?

public static void printShippingCharge(double weight) { if((weight > 0.0) && (weight <= 10.0)){ System.out.println(weight * 0.75); }

else if((weight > 10.0) && (weight <= 15.0)) { System.out.println(weight * 0.85); }

else if((weight > 15.0) && (weight <= 20.0)) { System.out.println(weight * 0.95); } }

public static void main(String args[]) {

printShippingCharge(18);

printShippingCharge(6);

printShippingCharge(25); }

Answer:

Two of the print statements will output values

Explanation:

These two calls to the printShippingCharge are the ones that will output values: printShippingCharge(18); and printShippingCharge(6);

The first if statement is true when the value of weight is 6 (weight > 0.0) && (weight <= 10.0)

The Third if statement  is true when weight is 18 (weight > 15.0) && (weight <= 20.0)

NOTE: That I made correction to the variable weight. The question isn't consistent with the variable name. It used weight and itemWeight at different points this will lead to a compiller error

You might be interested in
The term eof represents
rewona [7]

Answer:

EOF stands for End Of File

Google explains it well: EOF is a condition in a computer operating system where no more data can be read from a data source. The data source is usually called a file or stream.

8 0
2 years ago
Read 2 more answers
9. A change in the appearance of a value or label in a cell
alexandr402 [8]

Answer:

format

alignment

excel

=

Explanation: i'm an accountant

4 0
2 years ago
Which development model emphasizes small revisions that enhance the code and expand the functionality until the entire program i
algol [13]

Answer:

Iterative

Explanation:

is the model that emphasizes small revisions, unlike waterfall which is in a linear sequential flow.

5 0
2 years ago
20 POINTS!!!
Rina8888 [55]

Answer:

the third one

hope this helps

5 0
3 years ago
When are the malls going to open
Amiraneli [1.4K]
Idk maybe at 6:00pm today cuz most of the malls are close. Happy Thanksgiving! :D
3 0
2 years ago
Read 2 more answers
Other questions:
  • Which aspects of a project do project makers oversee?
    12·2 answers
  • Assume that play_list refers to a non-empty list, and that all its elements are integers. Write a statement that associates a ne
    7·1 answer
  • ________ is a set of rules for exchanging files such as text, graphic images, sound, video, and other multimedia files on the we
    14·1 answer
  • What data unit is encapsulated inside a packet?
    5·2 answers
  • The algorithm ____ is used to find the elements in one range of elements that do not appear in another range of elements.
    5·1 answer
  • List two types of energy sources
    10·2 answers
  • in the world of computing accessibilty most often refers to: a how quickly software opens , b password protection, c assistance
    6·1 answer
  • Which kind of image is indispensable and needs added text to go with ?
    12·1 answer
  • Write a short-essay discussing your own stand on social media usage for students.​
    5·1 answer
  • You can easily merge files even if each file contains a different record layout. Group of answer choices True False
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!