Question
IN JAVA CODING Using the Lab 1 Hello World assignment from Module 1, do the following: Rename the java file YourLastNameLab2. Rename the java class
IN JAVA CODING
Using the Lab 1 Hello World assignment from Module 1, do the following:
- Rename the java file YourLastNameLab2.
- Rename the java class by the same name as the java file.
- Prompt the user to enter their name.
- Print out the word "Hello" with the user's name before printing out "Hello World!"
For example, if the user enters "Kermit" as their name then the program will print out the following:
"Hello Kermit! Hello World!"
Don't forget to print a space between the two sentences!
NOTE: 1. Declare all variables within the data declaration section. 2 Do not get input on the same line as a variable declaration. 3. Do not place an equation for computation on the same line as declaring a variable.
Submit the java file.
---------------------------------------------------------------
the Lab 1 Hello World assignment to use
/********************************************************************** * Program Name: Hello World * Author: Your Name Goes Here * Date: Due date goes here * Course/Section: CSC 111-301W * Program Description: * This program will display the message "Hello World" **********************************************************************/ /************************** Compiler Directives **********************/ //Pre-Processor Declaration Section //imports import java.util.Scanner; public class HelloWorld //BEGIN Class Definition { public static void main (String[] args) //BEGIN Main Method { //Data Declaration Section Scanner scan = new Scanner(System.in); //Display message System.out.print ("Hello World!"); System.out.print (" "); } //End main }//end class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started