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
How would I copy this image?
Dahasolnce [82]

Question: <em>How would I copy this image?</em>

Answer: Either screenshot it, or CTRL C ± CTRL V it. To screenshot something, open 'snipping tool' and pull up the PDF, then box in whatever you are trying to copy. You can also reverse image search it to find it somewhere on the web.

Uplifting Note: To you, smiling at someone may mean nothing, but to them, it might be their whole world.

3 0
3 years ago
You have a desktop computer that supports both IEEE 1394 and USB 2.0. You are purchasing some devices that will connect to these
zimovet [89]

Answer:

IEEE 1394 supports more devices on a single bus

Explanation:

What this means is that IEEE 1394 provides a single plug-and-socket connection on which up to 63 devices can be attached with data transfer speeds up to 400 Mbps (megabit s per second). The standard describes a serial bus( A shared channel that transmits data one bit after the other over a single wire or fiber) or pathway between one or more peripheral devices and your computer's microprocessor .

7 0
3 years ago
A(n) ____ is a set of computer instructions.
sesenic [268]
A[n] program is a set of computer instructions.
4 0
3 years ago
If there is a combination of two or more attributes which is being used as the primary key then we call it as
Hunter-Best [27]

Answer:

Composite Keys.

.....Wubba Lubba Dub-Dub :))

5 0
2 years ago
What is a web designer's favorite snack
Nataly_w [17]
A web designers favorite snack is cookies.
5 0
3 years ago
Read 2 more answers
Other questions:
  • Ninety-two percent of the new information was stored on magnetic media, mostly in _____.
    11·1 answer
  • Mark for review (Will be highlighted on the review page) 3. Which one of the following word processing features saves you the mo
    14·1 answer
  • Using the __________ option, you can change the state of a model back to where a particular feature or features weren`t yet crea
    7·1 answer
  • Write an SQL statement to list the Name of employees who have worked on a property in New York .
    7·1 answer
  • In the context of the box model, what is the difference between a margin and padding
    8·1 answer
  • Develop a list of privacy protection features that should be present if a website is serious about protecting privacy. Then, vis
    8·1 answer
  • Given a number count the total number of digits in a number
    12·1 answer
  • Term of The surroundings and conditions of your workplace
    6·1 answer
  • 20.
    8·1 answer
  • This is your code.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!