A. Introduction

When programming, you will see an expression like x=x+1 quite often. More similar cases are y=y/4 or z=z*0.125. This is all because " = " has a different meaning in coding. Instead of "equals", it means "assignment". i.e. Assigning the RIGHT hand side of the equation to the LEFT hand side of the equation. In this case, x=x+1 means increasing x by 1 and assigning the value back to x.

Similarly, y=y/4 means reducing y value to 1 quarter of the original. z=z*0.125 means multiplying original z by 0.125 and assigning the product back to z.

As a matter of fact, this type of operations are so frequently used, that we have shortcut operators just for the purpose:

C. Now we have most elements of arithmetic expressions. Try:

Kahoot! at https://play.kahoot.it/#/k/48d259ba-546b-4169-905f-1c6f7d8e0bb7

• R4.1 Write declarations for storing the following quantities. Choose between integers and

floating-point numbers. Declare constants when appropriate.

a. The number of days per week

b. The number of days until the end of the semester

c. The number of centimeters in an inch

d. The height of the tallest person in your class, in centimeters

• R4.2 What is the value of mystery after this sequence of statements?

int mystery = 1;

mystery = 1 - 2 * mystery;

mystery = mystery + 1;

• R4.3 What is wrong with the following sequence of statements?

int mystery = 1;

mystery = mystery + 1;

int mystery = 1 - 2 * mystery;

R2 and R3 have the same problem; it must be mystery == mystery +1 to tie it back to mystery. R1 and R4 seems confusing.

mystery can't add by 1, and that's on both 2 and 3... For R1, a and c are constants, and b and d aren't.R1 and R4 is confusing, and I'm scratching my head, Because it shows Error, when I press run.

R2 = 0

R3 = because you've already defined mystery as a int so you don't have to define it again

R1 = a and c are constants, they are also integers, b and d are floating-point numbers

R4 = m * ( √ (1 + v / c) / √ (1 - v / c) - 1) = dm, π * r * r * h = volume, 4 * π * r^3 / 3 = volume,

√(x^2 + y^2) = zR2=0,

R3= Mystery has already been defined as an int so there's no need to define it again,

R4= I couldn't get this one bc it kept showing error all the time,

R1= a=int, constant. c=int, constant. b=float int. d=float int.

We will go through this together in the class today

you can't put R4 into codiva because there are undefined variables

https://www.codiva.io/p/8292b7b5-cb8c-4fa0-9612-c86a010732ca