Question

Keyboard Input Lab3 Ask the user for their name. Then display their name to prove that you can recall it. Ask them for their

For Java

0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Random;
import java.util.Scanner;

class Main{

    public static void main(String[] args) {
        //Scanner for reading input
        Scanner obj = new Scanner(System.in);
        //Prompt name
        System.out.println("Hello. What is your name?");
        String name = obj.next();
        System.out.println();
        //Prompt age
        System.out.println("Hi, "+name+"! How old are you?");
        int age = obj.nextInt();
        System.out.println();
        System.out.println("So you're "+age+", eh? That's not old at all!");
        //Prompt for income
        System.out.println("How much do you make, "+name+"?");
        double money = obj.nextDouble();
        System.out.println();
        System.out.println(money+"! I hope that's per hour and not per year! LOL!");
    }
}

OUTPUT :

Add a comment
Know the answer?
Add Answer to:
For Java Keyboard Input Lab3 Ask the user for their name. Then display their name to...
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
  • Display a welcome message and then ask the user to enter his/her name Display a personal...

    Display a welcome message and then ask the user to enter his/her name Display a personal welcome message by addressing the user by his/her name. Declare a constant and assign a number to it as the Conference Room capacity. Ask the user how many people are attending the meeting. Display a meaningful message for each of the three different scenarios. The message informs the user whether he/she can have the requested room and also displays the number of people that...

  • Write a program that prompts the user to enter a question (string) and display whether the...

    Write a program that prompts the user to enter a question (string) and display whether the question is correct. It is correct if it ends with the question mark (?) ----vyrovusmyzustning%20Class.pdf Programs with String Class Write a program that prompts the user to enter a question (string) and display whether the question is correct. It is correct if it ends with the question mark (?) Ask a question? Ask a question? How old are you What is your name? That's...

  • In Java, using only recursion. Ask the user for a list of integers. Display the greatest...

    In Java, using only recursion. Ask the user for a list of integers. Display the greatest number in the sequence. Allow any non-integer to end the input. DO NOT USE LOOPS. We are currently learning recursion and can only use recursion. Please provide notes so to better understand. Please describe how inputting a string will end the input section and then go on to execute what number is greater within the entire user input. -------------------------------------------------------------------------------- Standard Input                 5 20...

  • Java programming for ticket price calculator.  It should ask the user if they would like to process...

    Java programming for ticket price calculator.  It should ask the user if they would like to process another ticket order. They should indicate their selection with a Y or N. If they indicate yes, then it should repeat the entire program with the exception of the welcome screen. If they indicate no, it should show the final thank you message and end the program. If they indicate an invalid answer, it should display an error and re-prompt them for a Y...

  • 1. Create a script ScptCalXX (replace XX with your first or last name that does the...

    1. Create a script ScptCalXX (replace XX with your first or last name that does the following • It asks for your name with the following prompt: Please enter your name: • Then it asks for your city with the following prompt: Please enter the city where you live in: • Then it greets you with your name and city: Hello Syed from Toronto, how much money you want to invest today (-1 to quit)? (in case someone entered Syed...

  • in JAVA program.Use top-down design to design and implement a program to ask the user to...

    in JAVA program.Use top-down design to design and implement a program to ask the user to enter a list of integers, and then display to the user the mean and median of this list. You should first prompt the user to specify the length of the list of integers. For this assignment, your code should create an array of size 10, and then allow the user to specify the number of integers in their list, up to a maximum of...

  • Your program will ask the user to enter the amount of money they want to borrow,...

    Your program will ask the user to enter the amount of money they want to borrow, the interest rate, and the monthly payment amount. Your program will then determine how many months it will take to pay off that loan, what the final payment amount will be, and how much interest was paid over that time. If the monthly payment amount isn't high enough to pay off more than one month's interest, your program should notify the user what the...

  • Create java code Make sure it runs Part 1: Your little sister has decided that she...

    Create java code Make sure it runs Part 1: Your little sister has decided that she wants a pet. You love animals and want to further engender her love of animals, but, well, her last pet, goldie the goldfish, didn’t fare too well. So you went on the hunt for a different kind of pet that will fit the bill. Much to your joy, you have found the perfect pet for her… a Bee farm! They are easy to take...

  • Question 9 You survey 41 campers and ask them to rate how much fun they had...

    Question 9 You survey 41 campers and ask them to rate how much fun they had on a scale of 1 to 100. It is important to the campe that the campers have fun, so they ask you to perform an analysis to determine if the average fun score is above 90. You find the sample mean is 91.5 with a sample standard deviation of 11.7. (a) Write your hypotheses and define the parameter we hope to study in words....

  • JAVA Create a Governor class with the following attributes: name : String party - char (the...

    JAVA Create a Governor class with the following attributes: name : String party - char (the character will be either D, R or I) ageWhenElected : int Create a State class with the following attributes: name : String abbreviation : String population : long governor : Governor Your classes will have all setters, getters, typical methods to this point (equals(), toString()) and at least 3 constructors (1 must be the default, 1 must be the copy). You will be turning...

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
ADVERTISEMENT