Question

Need Java help: 1. Create a Java program that accepts input String input from a user...

Need Java help:

1. Create a Java program that accepts input String input from a user of first name.

2. Create a Java program that accepts input String input from a user of last name.

3. Concatenate the Strings in a full name variable and print to the console.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment...

import java.util.*;

public class FullName{

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.print("Enter first name: ");

String fname = in.next();

System.out.print("Enter last name: ");

String lname = in.next();

String fullName = fname+" "+lname;

System.out.println("Fullname is: "+fullName);

}

}

Add a comment
Know the answer?
Add Answer to:
Need Java help: 1. Create a Java program that accepts input String input from a user...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Java, How would I create a program that does this from user input? studentld: consists...

    In Java, How would I create a program that does this from user input? studentld: consists of the first two characters of the student's first name, student's birth year, and the last two characters of the last name. For instance, if the student's full name is John mith and birthyear is 1988, then the studentid will be jo1988th. s email: consists of the first name, dot, last name, and @pa2.com. For instance, if the student's full name is John Smith,...

  • Write a Java program which takes a string as a user input. Create 2 functions. The...

    Write a Java program which takes a string as a user input. Create 2 functions. The first function expects a string as argument and returns void. It converts all upper case characters to lower case and converts all lower case characters to upper case. It then prints out the converted string to a console. The second function also expects a string as argument and returns void. It will find first charactor that is repeated exactly 2 times in the string....

  • In the first task, you will write a Java program that accepts a string of the...

    In the first task, you will write a Java program that accepts a string of the format specified next and calculate the answer based on the user input. The input string should be of the format dddxxdddxx*, where d represents a digit and x represents any character and asterisk at the end represents that the string can have any number of characters at the end. 1. Prompt the user to enter a string with the specific format (dddxxdddxx*) 2. Read...

  • Create a class named Module2. You should submit your source code file (Module2.java). The Module2 class...

    Create a class named Module2. You should submit your source code file (Module2.java). The Module2 class should contain the following data fields and methods (note that all data and methods are for objects unless specified as being for the entire class) Data fields: A String object named firstName A String object named middleName A String object name lastName Methods: A Module2 constructor method that accepts no parameters and initializes the data fields from 1) to empty Strings (e.g., firstName =...

  • Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an...

    Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an integer. Once the input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do not use a bunch of if statements by themselves to solve this problem. You will print an error message for inputs greater than 100 and for inputs less than 0. Both errors must be...

  • use Java and it must work for any name String Manipulator Write a program to manipulate...

    use Java and it must work for any name String Manipulator Write a program to manipulate Strings. Store your full name into one String variable. It must include first name, middle name, last name, cach separated by spaces. Spaces could vary. If you do not have a middle name make up one For example the string to be processed could be any of the following John Plain Doe John Plain Doc John Plain Doe Your program must be able to...

  • 1. Create a NetBeans project under the name PlayingWithJavaStrings. 2. In the source code do the...

    1. Create a NetBeans project under the name PlayingWithJavaStrings. 2. In the source code do the following: i) Create two separated String variables, one for the first and the other for the last names and set them to “John” and “Smith”, respectively. ii) Create a String variable for the full name and then concatenate the first and last name variables into it. 3. Using the String methods found in the Java API: Print the full name in the terminal window...

  • Write a Java program that will create an array of Strings with 25 elements. Input Strings...

    Write a Java program that will create an array of Strings with 25 elements. Input Strings from the user and store them in the array until either the user enters “quit” or the array is full. HINT: the sentinel value is “quit” all lowercase. “Quit” or “QUIT” should not stop the loop. HINT: you have to use the equals method (not ==) when you are comparing two Strings. After the input is complete, print the Strings that the user entered...

  • I need help getting my program to reject a negative input from the user. Here is...

    I need help getting my program to reject a negative input from the user. Here is what I have: #short description of what the program will do print("Hello, this program will ask you to enter a non-negative decimal integer. The program will then show the binary equivalent of the integer you choose.") #ask the user to enter the non-negative decimal integer number= int(input("Enter a non-negative decimal integer: ")) while number< 0: print("Number Cannot Be Negative!! Try again...") #create a variable...

  • Write a java program that accepts a string from the user. List all characters in the...

    Write a java program that accepts a string from the user. List all characters in the string from lowest ASCII value to highest and output the number of occurrences for each of those characters.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT