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]
3 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]3 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
A file name extension provides what information about a file?
yanalaym [24]

Answer:

A file extension or file name extension is the ending of a file that helps identify the type of file in operating systems, such as Microsoft Windows. In Microsoft Windows, the file name extension is a period that is often followed by three characters but may also be one, two, or four characters long.

Explanation:

8 0
3 years ago
Please helpp!! I need it quickly!
gregori [183]

Answer:

a

Explanation:

5 0
3 years ago
What port in your computer will you use to plug in your camera?
V125BC [204]
I think it would be fire wire
8 0
3 years ago
Read 2 more answers
Artists who draw images on a computer often use a stylus in conjunction with special _________ tablets, which offer extra-sensit
hodyreva [135]

Answer:

Graphics is the correct answer to the following question.

Explanation:

The following answer is true because Graphic tablet is the device in which a person can draw graphics, images or they can also draw by their hands with use of digital pen which is use for drawing as they draw images on the paper. we can also say the graphic tablet is used for the digital art.

So, That's why the following answer is correct.

6 0
3 years ago
What is the term used to describe a computer system that can store literary documents, link them according to logical relationsh
zvonat [6]

Answer:

hypertext

Explanation:

Hypertext is used to describe a computer system that could store literary documents, link them

according to logical relationships, and allow readers to comment and annotate what they read.

Hypertext can also be said to be a system in which text on one page is used to link to text on other pages. They are simply text with links to other text.

Examples of hypertext footnotes, indexes, magazines, newspapers, etc.

A hypertext fiction can be described as an electronic literature with use of hypertext links.

3 0
3 years ago
Other questions:
  • ____ languages create source code using words and structures similar to spoken language.​
    15·1 answer
  • What processes are needed to transform a c++ program to a machine language program that is ready for execution?
    14·1 answer
  • QUESTION
    10·1 answer
  • In preparing his persuasive presentation, Reza should most likely focus on clearly presenting his
    6·2 answers
  • Which examples demonstrate common education and qualifications for Manufacturing Production Process Development careers? Check a
    12·2 answers
  • Identify similarities and differences of hibiscus leaves <br>​
    14·1 answer
  • Hey guys, I don’t have a problem for you but If anyone knows do you still pass your grade level if you failed 1 class in the las
    11·2 answers
  • Is social media bringing people together or cause in sepretation?​
    11·2 answers
  • Difference between a port and a connector
    10·1 answer
  • When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!