MIS 260 Practice - week 7
1. Visit the class web page, and then download DebugEight2 Java files. The file has syntax and/or logical errors. Determine the problem and fix the program.
2. Below is a partially completed program that is designed to store vowels (a, e, i, o, and u) in an array. Fill out the underline blank lines to complete it. The program asks the user to enter a character. Then the program indicates whether the entered character is a vowel.
public class VowelArray {
public static void main (String args[]) throws Exception {
char[] vowels = {______________________________ };
int i = 0;
char g = ' ';
boolean isVowel = false;
// The functionality of below bolded lines are almost exactly same as the
//BufferReader code. Thus, do not concern with these lines….
System.out.print("Enter a character: ");
g = (char)System.in.read();
System.in.read();
System.in.read();
for (_________________________) {
if (g = = vowels[i])
isVowel = true;
}
if (_______________________)
System.out.println(g + " is a vowel");
else
System.out.println(g + " is NOT a vowel");
}
}
Java Assignment 6: (Turn in by email – attach program)
Due: will be announced by instructor
Score: 10 points