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
polet [3.4K]
3 years ago
9

Write assignment statements that perform the following operations with the variables a, b, and c. i. Adds 2 to ‘a’ and assigns t

he result to ‘b’. ii. Multiplies ‘b’ times 4 and assigns the result to ‘a’. iii. Divides ‘a’ by 3.14 and assigns the result to ‘b’. iv. Subtracts 8 from ‘b’ and assigns the result to ‘a’.
Computers and Technology
1 answer:
solniwko [45]3 years ago
3 0
<h2>Answer: </h2>

(i) b = a + 2;

(ii) a = b * 4;

(iii) b = a / 3.14;

(iv) a = b - 8;

<h2>Explanation: </h2><h3>Assumptions and comments; </h3>

=> The code has been written in Java.

=> The variable a, b and c have been declared.

=> The variable c has only been declared but not used since it is not part of the assignment procedures.

<h3>Explanation: </h3>

The following is the assignment statement that;

<em>(i) Adds 2 to ‘a’ and assigns the result to ‘b’</em>

To add a number to another number or variable, the arithmetic operator (+) is used using the following syntax;

[number] [+] [other number]

In our case, the number is variable a and the other number is 2. Therefore, to add these numbers together we write;

a + 2;

Also, assignment in programming languages is done using the (=) operator. For example to assign a number k to a variable m, we write;

m = k

In our case, the result (a + 2) from above is assigned to variable b as follows;

=> b = a + 2

<em>(ii) Multiplies ‘b’ times 4 and assigns the result to ‘a’.</em>

To multiply a number by another number or variable, the arithmetic operator (*) is used using the following syntax;

[number] [*] [other number]

In our case, the number is variable b and the other number is 4. Therefore, to multiply these numbers we write;

b * 4;

Also,

In our case, the result (b * 4) from above is assigned to variable a as follows;

=> a = b * 4

<em>(iii) Divides ‘a’ by 3.14 and assigns the result to ‘b’.</em>

To divide a number by another number or variable, the arithmetic operator (/) is used using the following syntax;

[number] [/] [other number]

In our case, the number is variable a and the other number is 3.14. Therefore, to divide these numbers we write;

a / 3.14;

Also,

In our case, the result (a / 3.14) from above is assigned to variable b as follows;

=> b = a / 3.14

<em>(iv) Subtracts 8 from ‘b’ and assigns the result to ‘a’.</em>

To subtract a number from another number or variable, the arithmetic operator (-) is used using the following syntax;

[other number] [-] [number]

In our case, the number is 8 and the other variable is b. Therefore, to subtract these numbers we write;

b - 8;

Also,

In our case, the result (b - 8) from above is assigned to variable a as follows;

=> a = b - 8;

You might be interested in
Which of the Arts, A/V Technology, and Communication career cluster pathways are involved with producing a product for an audien
PIT_PIT [208]

I believe the pathways are Audio/Visual Technology and Film, Journalism and Broadcasting and Printing Technology .


5 0
3 years ago
Read 2 more answers
Which keyboard shortcut would you press to copy cells that are selected in a spreadsheet?
CaHeK987 [17]

Answer:

ctrl c

Explanation:

4 0
2 years ago
WHAT IS MULTIMEDIA SUPPOSED TO MEAN ???
melisa1 [442]

Answer:

using more than one medium of expression or communication

3 0
2 years ago
Read 2 more answers
A device capable of copying a graphic, document, or other object is called a
Amiraneli [1.4K]
A printing press or printer
5 0
3 years ago
Read 2 more answers
What is the output of intb= 4+ 6 /2 Systemoutprintln (b)
uysha [10]

Answer:

Command: Systemoutprintln (b)

Output: 7

Explanation:

To solve this problem, we must take into account the precedence of operation.

The division takes precedence before the addition, so we must divide before we add for b.

So

int b = 4 + 6/2 = 4 + 3 = 7.

So

Command: Systemoutprintln (b)

Output: 7

5 0
3 years ago
Other questions:
  • Which of the following information security technology is used for avoiding browser-based hacking?
    11·2 answers
  • Behaving in an acceptable manner within a workplace environment is referred to as having
    9·1 answer
  • A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: The name of the clie
    11·1 answer
  • Henry went to an IT software company for an interview he was offered a position in lower level management which positions could
    11·1 answer
  • Which command allows d1 to configure an ip address on one of its physical interfaces?
    9·1 answer
  • A report has a column of totals, with each total adding to the cell above it. What kind of calculated figure is this?
    15·1 answer
  • Krya needs help deciding which colors she should use on her web page. What can she use to help her decide.
    11·1 answer
  • Anyone on ps4 willing to trade me a fennec or McClaren on rocket league?
    6·2 answers
  • Give one (1) advantage and one(1) disadvantage of using and integrated software package over a custom written one.
    15·1 answer
  • Ginny faced an application error while executing the recorder in opera. Which web browser is generally recommended to use with r
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!