A code I did in high school.
A code I did in high school.
import java.util.Scanner;//importing the Scanner.
public class Letter{//Starting the program.
public static void Letter(){//Initialising the class.
Scanner Letter=new Scanner(System.in);//So that the user can input the letter.
System.out.println("Enter a letter.");//Asking the user for a letter.
final char letter=Letter.next[].charAt(0);//Storing the user input.
switch(letter){//Checkign for the letter that the user input.
case 'A'://If the user had input A.
case 'a'://If the user had input a.
case 'E'://If the user had input E.
case 'e'://If the user had input e.
case 'I'://If the user had input I.
case 'i'://If the user had input i.
case 'O'://If the user had input O.
case 'o'://If the user had input o.
case 'U'://If the user had input U.
case 'u'://If the user had input u.
System.out.print(Letter+" is a vowel.");//Printing an appropriate message.
case 'B'://If the user had input B.
case 'b'://If the user had input b.
case 'C'://If the user had input C.
case 'c'://If the user had input c.
case 'D'://If the user had input D.
case 'd'://If the user had input d.
case 'F'://If the user had input F.
case 'f'://If the user had input f.
case 'G'://If the user had input G.
case 'g'://If the user had input g.
case 'H'://If the user had input H.
case 'h'://If the user had input h.
case 'J'://If the user had input J.
case 'j'://If the user had input j.
case 'K'://If the user had input K.
case 'k'://If the user had input k.
case 'L'://If the user had input L.
case 'l'://If the user had input l.
case 'M'://If the user had input M.
case 'm'://If the user had input m. case 'N'://If the user had input N.
case 'n'://If the user had input n.
case 'P'://If the user had input P.
case 'p'://If the user had input p.
case 'Q'://If the user had input Q.
case 'q'://If the user had input q.
case 'R'://If the user had input R.
case 'r'://If the user had input r.
case 'S'://If the user had input S.
case 's'://If the user had input s.
case 'T'://If the user had input T.
case 't'://If the user had input t.
case 'U'://If the user had input U.
case 'u'://If the user had input u.
case 'V'://If the user had input V.
case 'v'://If the user had input v.
case 'W'://If the user had input W.
case 'w'://If the user had input w.
case 'X'://If the user had input X.
case 'x'://If the user had input x.
case 'Y'://If the user had input Y.
case 'y'://If the user had input y.
case 'Z'://If the user had input Z.
case 'z'://If the user had input z.
System.out.println(Letter+" is a consonant.");//Printing an appropriate message.
default://If anything else happens.
System.out.print("Error.");//Printing an appropriate message.
}//Closing the curly brackets.
}//Closing the curly brackets.
}//Closing the curly brackets.
I feel like every new developer has that phase where it's drilled in them that documentation is good, so they comment everything lol
2 0 Reply