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
Alchen [17]
3 years ago
7

Evaluate the expression. Be sure to list a value of appropriate type (e.g., 7.0 rather than 7 for a double, Strings in quotes).

19 / 2 / 2.0 + 2.5 * 6 / 2 + 0.5 * 4
Computers and Technology
1 answer:
Mashutka [201]3 years ago
6 0
<h2>Answer:</h2>

14.0

<h2>Explanation:</h2>

Using the level of precedence in Java,

From left to right;

(i) the first division operation will be done.

(ii)followed by the second division operation.

(iii)followed by the first multiplication operation.

(iv)followed by the third division operation.

(v)followed by the second multiplication operation.

(vi) followed by the first addition operation.

(vii)lastly followed by the second addition operation.

=================================================

Taking the steps above one after the other;

<em>(i) the first division operation will be done (i.e 19 / 2)</em>

=> Integer division in Java gives an integer result. Therefore, 19 / 2 = 9.5 will give 9.

So,

=><em> </em><u>19 / 2</u> / 2.0 + 2.5 * 6 / 2 + 0.5 * 4

=> 9 / 2.0 + 2.5 * 6 / 2 + 0.5 * 4

<em>(ii)followed by the second division operation. (i.e 9 / 2.0)</em>

=> From the result from step (i), the second division operation is now 9 / 2.0.

=> 9 / 2.0 = 4.5

So,

=> <u>9 / 2.0</u> + 2.5 * 6 / 2 + 0.5 * 4

=> 4.5 + 2.5 * 6 / 2 + 0.5 * 4

<em>(iii)followed by the first multiplication operation. (i.e 2.5 * 6)</em>

=> The first multiplication operation is given by 2.5 * 6

=> 2.5 * 6 = 15.0

So,

=> 4.5 + <u>2.5 * 6</u> / 2 + 0.5 * 4

=> 4.5 + 15.0 / 2 + 0.5 * 4

<em>(iv)followed by the third division operation. (i.e 15.0 / 2)</em>

=> The third division operation is given by 15.0 / 2

=> 15.0 / 2 = 7.5

So,

=> 4.5 + <u>15.0 / 2</u> + 0.5 * 4

=> 4.5 + 7.5 + 0.5 * 4

<em>(v)followed by the second multiplication operation. (i.e 0.5 * 4)</em>

=> The second multiplication operation is given by 0.5 * 4

=> 0.5 * 4 = 2.0

So,

=> 4.5 + 7.5 + <u>0.5 * 4</u>

=> 4.5 + 7.5 + 2.0

<em>(vi) followed by the first addition operation. (i.e 4.5 + 7.5)</em>

=> The first addition operation is given by 4.5 + 7.5

=> 4.5 + 7.5 = 12.0

So,

=> <u>4.5 + 7.5</u> + 2.0

=> 12.0 + 2.0

<em>(vii) lastly followed by the second addition operation. (i.e 12.0 + 2.0)</em>

=> The second addition operation is given by 12.0 + 2.0

=> 12.0 + 2.0 = 14.0

So,

=> <u>12.0 + 2.0</u>

=> 14.0

<em>Therefore, 19 / 2 / 2.0 + 2.5 * 6 / 2 + 0.5 * 4 = 14.0</em>

<h2>Note:</h2>

In Java, the order of precedence for arithmetic operators is;

=> /, * and %

=> followed by + and -

You might be interested in
Computer in country development explain explain explain in presentation.<br>​
yaroslaw [1]

Answer:

A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as programs. These programs enable computers to perform a wide range of tasks. A computer system is a "complete" computer that includes the hardware, operating system (main software), and peripheral equipment needed and used for "full" operation. This term may also refer to a group of computers that are linked and function together, such as a computer network or computer cluster

6 0
3 years ago
What do you mean by an algorithm?<br>​
Over [174]
A program that can be used in many scenarios
8 0
3 years ago
ANSWER ASAP!!! 12 POINTS!!!!! RIGHT ANSWERS ONLY
suter [353]

Answer:

B.

Explanation:

8 0
2 years ago
Read 2 more answers
If a line is 4’ and you scaled it using 1/8” =1’ what would the size of the line be?
Gnesinka [82]
One half inch to scale
8 0
3 years ago
Guys helppppppppppppp!! plxxx <br> give me the right answer !
sweet-ann [11.9K]
Try "an online advertisement for a video game you recently read about in a blog post".

Hope I helped! :)
5 0
3 years ago
Other questions:
  • The way a program is proceed is know as control flow and are :Sequence(one line after the other), Decision-making(either this or
    8·1 answer
  • Done through Block Py/ Python
    11·1 answer
  • Many commercial encryption programs use a technology called ____, which is designed to recover encrypted data if users forget th
    12·1 answer
  • How do you add Rulers to a document?: *
    6·1 answer
  • VEE Physics 2006 E.C
    7·1 answer
  • Question # 6
    11·2 answers
  • Will give brainliest!<br> Who created binary, and does anyone have any idea how?
    13·1 answer
  • Viktor has climbed a tall tree to get a good view of the giraffes on the savannah. He is snapping lots of photographs of the gir
    8·1 answer
  • Please help with this coding question
    8·2 answers
  • How to get an object from a container in java.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!