Answer to Question #301817 in Java | JSP | JSF for corejj

Question #301817
  • Create a folder named LastName_FirstName (ex. Reyes_Mark) in your local drive.
  • Create a new Java application project named LabExer1A. In the Create Main Class field, the text should be labexer1a.LabExer1A. Set the project location to your own folder.
  • Initialize four (4) variables based on the table below.

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.

  • 12 is my favorite number. I love Doraemon!

My name is Veronica V. Velasquez. You can call me Nica.

  • Use comments to give a short description of the parts of the program. Note: Use // for single-line

comments and /* */ for multi-line comments.

  • Inform your instructor once you are done.
1
Expert's answer
2022-02-23T14:17:59-0500
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(".");

    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS