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

Modify printFace() to have three parameters: char eyeChar, char noseChar, char m

ID: 3779812 • Letter: M

Question

Modify printFace() to have three parameters: char eyeChar, char noseChar, char mouthChar. Call the method with arguments 'o', '*', and '#', which should draw this face:

This is the given code to modify:

public class SimpleFace {
public static void printFace(char faceChar) {
     System.out.println(" " + faceChar + " " + faceChar);      // Eyes
     System.out.println("   " + faceChar);                      // Nose
     System.out.println(" " + faceChar + faceChar + faceChar); // Mouth
     return;
}

   public static void main (String [] args) {
     printFace('o');
     return;
}
}

Explanation / Answer

public class SimpleFace {
public static void printFace(char eyeChar,char noseChar,char mouthChar) {
System.out.println(" " + eyeChar + " " + eyeChar); // Eyes
System.out.println(" " + noseChar); // Nose
System.out.println(" " + mouthChar + mouthChar + mouthChar); // Mouth
return;
}
public static void main (String [] args) {
printFace('o','*','#');
return;
}
}
/*
sample output
o o
*
###
*/

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