Data Type
Variable Name
Value
int
faveNumber
Type your favorite number.
String
faveCartChar
Type your favorite cartoon or anime character.
char
mi
Type your middle initial.
char (array)
nickNameArray
Every index should contain
each of the letters of your nickname.
My name is Veronica V. Velasquez. You can call me Nica.
comments and /* */ for multi-line comments.
package labexer1a;
import java.util.Scanner;
public class LabExer1A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Type your favorite number.");
int faveNumber = Integer.parseInt(in.nextLine());
System.out.println("Type your favorite cartoon or anime character.");
String faveCartChar = in.nextLine();
System.out.println("Type your middle initial.");
char mi = in.nextLine().charAt(0);
System.out.println("Nickname.");
char[] nickNameArray = in.nextLine().toCharArray();
System.out.println(faveNumber + " is my favorite number. I love " + faveCartChar + "!");
System.out.print("My name ? " + mi + ". ?. You can call me ");
for (int i = 0; i < nickNameArray.length; i++) {
System.out.print(nickNameArray[i]);
}
System.out.println(".");
}
}
Comments
Leave a comment