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

Consider the following Java if expression: if ( done.equalsIgnoreCase(“yes”) ) &

ID: 3859184 • Letter: C

Question

Consider the following Java if expression:

                        if ( done.equalsIgnoreCase(“yes”) ) && n != 10 )

                        {

                                    y = k.readWord( );

                        }

                        else

                        {

                                    done = z;

                        }

         Use the context in the above code to determine the data type of the following variables and declare them below.

____ done;

_____ n;

_____ y;

_____ k;

_____ z;

Explanation / Answer

String done;

done is compared with a String so it must be a String

int n;

n is compared with integer so it must be an integer

String y;

readWord() returns a String so y must be a String

MyReader k= new MyReader(Filename);

k is the inputstream associated with the Filename. MyReader is eg a class to read from file

String z;

z is assigned a String so it must be a String

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