1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alex41 [277]
2 years ago
9

Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output tho

se four values on a single line separated by a space.Enter integer:99Enter double:3.77Enter character:zEnter string:Howdy99 3.77 z Howdyimport java.util.Scanner;public class BasicInput {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int userInt;double userDouble;// FIXME Define char and string variables similarlySystem.out.println("Enter integer:");userInt = scnr.nextInt();// FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space
Computers and Technology
1 answer:
katen-ka-za [31]2 years ago
5 0

Answer:

import java.util.Scanner;

public class BasicInput {

   public static void main(String[] args) {

       //Create an object of the Scanner class

       Scanner scnr = new Scanner(System.in);

       

       //Define int and double variables

       int userInt;

       double userDouble;

       

       //Define char and string variables similarly

       char userChar;

       String userString;

       

       //Prompt the user to enter an integer

      System.out.println("Enter integer:");

       //Store the input in the integer variable

       userInt = scnr.nextInt();

       

       //Prompt the user to enter a double

        System.out.println("Enter double:");

       //Store the input in the double variable

      userDouble = scnr.nextDouble();

       

       //Prompt the user to enter a char

        System.out.println("Enter char:");

       //Store the input in the char variable

      userChar = scnr.next().charAt(0);

       

       //Prompt the user to enter a string

        System.out.println("Enter String:");

       //Store the input in the string variable

      userString = scnr.next();

       

       //Output the four values on a single line

       //separated by a space

       System.out.println(userInt + " " + userDouble + " " + userChar + " " + userString);

       

   }

   

}

Sample Output:

Enter integer:

>>12

Enter double:

>>23

Enter char:

>>s

Enter String:

>>asdasd

12 23.0 s asdasd

Explanation:

The code above has been written in Java. It contains comments explaining every part of the code. Please go through the comments.

You might be interested in
Which LIKE operator would match a single character?<br><br> *<br> ?<br> []<br> #
algol [13]

Answer:

underscore hope that helps

Explanation:

4 0
2 years ago
Do the police check your mobile device during police checks?
Marat540 [252]
it depends............

4 0
2 years ago
Read 2 more answers
Which 3 file formats can be used for importing lists directly into quickbooks online?.
Natali5045456 [20]

Answer:

Explanation:

QBO

IIF

QBJ

8 0
1 year ago
Which of the following functions of Information Security Management seeks to dictate certain behavior within the organization th
Dmitriy789 [7]

Answer:

The correct answer to the following question will be Option B (Policy).

Explanation:

  • The Policy is a systematic set of rules for driving policies and obtaining rational results. It is a declaration of intent and is applied as a process or protocol.
  • Policies are usually implemented by the governing body throughout the corporation.
  • It was the feature of Information assurance management, which sought to dictate those activities throughout the organization via a collection of institutional requirements.

Therefore, Option B is the right answer.

7 0
2 years ago
According to Android’s suggested user interface standards, repeatedly pressing the app icon on an app’s action bar will eventual
marusya05 [52]

Answer:

False

Explanation:

No app icon on app's action bar will move the device  to its home screen.It is not a valid statement.

8 0
2 years ago
Read 2 more answers
Other questions:
  • ​You work at a call center of a large bank where you answer credit card services related questions from customers. Lately, you h
    14·1 answer
  • What type of device does a computer turn to first when attempting to make contact with a host with a known IP address on another
    6·1 answer
  • PLEASE HELP ME ASP<br> An ISDN carries a signal in digital form.<br><br> True<br><br> False
    12·2 answers
  • I NEED IT FOR TODAY FOR KEYBOARDING TEST! GIVE ME CORRECT ANSWER PLZ!
    12·2 answers
  • Fill in the blank: _________ is Google’s machine-learning artificial intelligence system that interprets people’s searches to fi
    9·1 answer
  • Which part of a touchscreen responds to pressure applied to its surface?
    6·1 answer
  • In a dark place you have only a match , a twig , campfire logs , and oil lamp and a candle which do you literally first /
    15·1 answer
  • Several disaster relief nonprofits want to create a centralized application and repository of information so that they can effic
    7·1 answer
  • Terence creates software requirements specification (SRS) documents for various software development projects. In which phase of
    6·1 answer
  • The current annual interest rate is 5 percent, and you are taking out a 20-year loan with a monthly end-of-month payment. If you
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!