Solved

Consider the Following Paint Method to Answer the Questions Below

Question 19

Multiple Choice

Consider the following paint method to answer the questions below:
public void paint(Graphics page)
{
int x, y = 200;
page.setColor(Color.blue) ;
for (x = 100; x < 200; x += 20)
page.fillRect(x, y, 10, y-x) ;
}
-What will the following code do? Assume s is a String, x is an int initialized to 10, page is a Graphics object, and this is part of a paint method for an applet.
Boolean isVowel = false;
String vowels = "aeiou";
For (int j = 0; j < s.length( ) ; j++)
{
For (int k = 0; k < 5; k++)
If (s.charAt(j) == vowels.charAt(k) ) isVowel = True;
If (isVowel) page.drawString(""+s.charAt(j) , 10, 15*x++) ;
Else page.drawString(""+s.charAt(j) , 110, 15*x++) ;
IsVowel = false;
}


A) The String s is printed down the applet in two columns, alternating each letter
B) The String s is printed across the applet with vowels printed in one row and all other characters printed in a row above the vowels
C) The String s is printed across the applet with vowels printed in one row and all other characters printed in a row below the vowels
D) The String s is printed down the applet in two columns with vowels appearing in the left column and all other characters in the right column
E) The String s is printed down the applet in two columns with vowels appearing in the right column and all other characters in the left column

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents