Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1042 Given an integer variable profits , write a statement that increases the va

ID: 3542111 • Letter: 1

Question


1042

Given  an integer  variable   profits , write a statement  that increases  the value  of that variable  by a factor of 10.


10964

Write a statement  using a compound assignment operator  to change val to the remainder when val is divided by 16 (val has already  been declared  and initialized )


10561

Write a conditional  that assigns   10,000 to the variable   bonus if the value  of the variable   goodsSold is greater than   500,000 .


10636

Given  the integer  variables   x and  y , write a fragment of code that assigns  the larger  of  x and  y to another integer  variable   max .

Explanation / Answer

1042
Given an integer variable profits , write a statement that increases the value of that variable by a factor of 10.

profits = profits*10;

10964
Write a statement using a compound assignment operator to change val to the remainder when val is divided by 16
(val has already been declared and initialized )

val = val%16;

10561
Write a conditional that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000 .

bonus = goodsSold>500000?10000:0;

10636
Given the integer variables x and y , write a fragment of code that assigns the larger of x and y to another integer variable max .

max = x>y?x:y;

10667
Given the integer variables x , y , and z , write a fragment of code that assigns the smallest of x , y , and z to another integer variable min .
Assume that all the variables have already been declared and that x , y , and z have been assigned values ).

min = x;
if(y<min) min = y;
if(z<min) min = z;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote