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

Java Task #1 – Desk Checking Assume that any variables in the following code sni

ID: 3930674 • Letter: J

Question

Java

Task #1 – Desk Checking

Assume that any variables in the following code snippets have been properly declared.

Can you find the errors (if any) in the following statements and if so, what are they?

1) if (x == 1)

                                y=2;

                else if (x==2);

                                y=3;

2) Count = 0;

if (COUNT == 0)

Count = COUNT + 1;

3) if (average = 100)

System.out.println(“You have a perfect grade”);

4) X==4;

X = X/2;

System.out.println(“the answer is “ + X);

5)   X = A + B / C – D * E – 7 * F;

Explanation / Answer

Question 1:

Answer: Removed sem colon from else if (x==2);

1) if (x == 1)

y=2;

else if (x==2)

y=3;

Question 2:

Answer:

Count = 0;

if (Count == 0)

Count = Count + 1;

Question 3:

Answer:

if (average == 100)

System.out.println(“You have a perfect grade”);

Question 4:

Answer:

X=4;

X = X/2;

System.out.println(“the answer is “ + X);

Question 5:

Answer:

X = (A + B) / (C – D * E – 7 * F);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote