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
Which one of the following is true about employer responsibility in providing fall protection to workers? not selected A. Employ
Luda [366]

Option B is the correct answer, Employers have flexibility in choosing a fall protection system they believe will work best in a situation selected. It is the primary duty of employer to provide safety to its workers. Employers must setup a suitable protection system at workplace from falling off from overhead platforms and from elevated workstations during construction for safety of its employees.  

Further Explanation:

⦁ Employer must ensure compliance to OSHA-Fall protection in construction.

⦁ Generally, fall protection must be ensured by deploying guardrail systems at the edge of construction sites, safety systems built by nets or personal fall arrest.

⦁ OSHA requires to built fall protection system irrespective of fall distance to make sure safety conditions for workers/ employees.

Answer details:

Grade: High School

Subject: Computer Science and Technology.

Learn More:

Fall protection and compliance to OSHA rules and regulations

brainly.com/question/8910167

Employer responsibility in providing fall protection

brainly.com/question/5872956

Key Words: Fall protection, OSHA, workplace safety, guardrail systems etc.

Image of guardrail as an example is attached.

5 0
3 years ago
Read 2 more answers
How to transfer photos from iphone to iphone?
STALIN [3.7K]
If you have icloud then you can transfer them.
7 0
3 years ago
Read 2 more answers
Given a string, an integer position, and an integer length, all on separate lines, output the substring from that position of th
lana [24]

quetma es elpx mjeghgieo

4 0
3 years ago
Write a query that returns the Genres that I have purchased the most tracks of. I only care about genres that I've purchased at
Murljashka [212]

Answer:

<em>SQL Query</em>

///////////////////////////////////////////////////////////////////////////////////////////////////

select Genre_Name, Number_Purchased from Genre

INNER JOIN Tracks on Genre.Genre_Name = Tracks.Genre_Name

WHERE Number_Purchased >= 10 AND Tracks.price >= 1

ORDER BY Number_Purchased ASC;

Explanation:

First off, I selected the required columns from <em>Genre</em> Table.

Then I inner joined <em>Genre</em> table with <em>Tracks</em> table, to get the <em>price</em> of tracks of the corresponding Genres.

Then the required Where conditions are written, which includes one from the <em>Tracks</em> table.

Finally, the Order by statement is written by <em>Number_Purchased</em> column in ascending (ASC) order.

6 0
3 years ago
The process of converting software to operate in a second language is called software _______.
kari74 [83]

Answer:

software localization

Explanation:

As international systems penetrate deeper into management and clerical groups, a common language is formed

4 0
1 year ago
Other questions:
  • When data are entered into a form and saved, they are placed in the underlying database as knowledge?
    10·1 answer
  • what properties are associated with all Microsoft Office files and include author, title, and subject
    5·1 answer
  • The _____ icon allows the user to improve the brightness, contrast, or sharpness of the picture.
    10·1 answer
  • Where does most of the work in creating a presentation will take place? Either formatting toolbar, normal (Slide) view, slide so
    12·2 answers
  • ​Case-Based Critical Thinking Questions​Case 9-1Melissa, a computer science engineering student, is learning the basics of progr
    11·1 answer
  • Tanner is creating a brochure for his Web-hosting company. He designed the layout and placed a picture in the center of the page
    13·1 answer
  • How to wire two separate switches &amp; lights using the same power source?
    14·1 answer
  • What are the 5 characteristics of flowchart<br>​
    14·1 answer
  • DRAG DROP -A manager calls upon a tester to assist with diagnosing an issue within the following Python script:#!/usr/bin/python
    11·1 answer
  • (a) What is the meaning of word 'computer (b) Cive a reason for the evolution of computer (c) Write a weakness of a computer (d)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!