Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in this program, you will learn how to enter data while the program is running by using the Scanner class enter the following command in

in this program, you will learn how to enter data while the program is running
by using the Scanner class
enter the following command in your code winder BEFORE the myAge class:
import java.util.Scanner
the Scanner class is needed for input, and Scanner is part of the java.util package
inside your myAge class, in-between the curly brackets:
enter this command: Scanner input = new Scanner(System.in);
this command makes input available to this class
next, enter a command that prompts the user to enter their age (use the System.out.print command, with the prompt inside parentheses, and in quotes).
next command: int age = input.nextInt();
this command will pause the program, while it waits for input
final command: use a System.out.print command to display a sentence that says "You are "+ age, which should confirm the age you input
save and run your program
to input your age, go to the output window and you should see your prompt
click after the prompt and key in your age; enter
sample program output: Enter your age:
55
You are 55

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

Define promotion.

Answered: 1 week ago

Question

Write a note on transfer policy.

Answered: 1 week ago

Question

Discuss about training and development in India?

Answered: 1 week ago

Question

Explain the various techniques of training and development.

Answered: 1 week ago

Question

Explain the various techniques of Management Development.

Answered: 1 week ago

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago