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
Match the following tasks with their appropriate timing.
Oliga [24]

Answer:

3. 1. 2. daily, weekly, monthly

Explanation:

8 0
3 years ago
My ar goal is 16.3 what percent am i at if i have 3 points??
Mazyrski [523]

24 percent so far so keep working at that goal

5 0
3 years ago
Individually or in a group find as many different examples as you can of physical controls and displays.a. List themb. Try to gr
Angelina_Jolie [31]

Answer:

Open ended investigation

Explanation:

The above is an example of an open ended investigation. In understanding what an open ended investigation is, we first of all need to understand what open endedness means. Open endedness means whether one solution or answer is possible. In other words it means that there may be various ways and alternatives to solve or answer a question or bring solution to an investigation.

From the definition, we can deduce that an open ended investigation is a practical investigation that requires students to utilize procedural and substantive skills in arriving at conclusion through evidence gathered from open ended research or experiment(as in not close ended, not limited to ready made options, freedom to explore all possibilities). This is seen in the example question where students are asked to explore the different examples of physical controls and displays and also discuss their observations. Here students are not required to produce a predefined answer but are free to proffer their own solutions

7 0
3 years ago
In what way are a coffee maker and a dishwasher the same?<br><br>BY THE WAY THIS IS TEENBIZ
weeeeeb [17]
They both need electricity. Both used in the kitchen.
3 0
3 years ago
Read 2 more answers
Which bitwise operation has the same effect as multiplying a by 16?
Shalnov [3]
<span>Jun 15, 2011 - Multiplication and division can be achieved using bit operators, for example .... I discovered pretty much the same thing for Sun CC close to 20 years ago. ... Just to add a rough estimation: On a typical 16-Bit processor ..... Doing it yourself willaffect readability and possibly have no effect on performance.</span><span>
</span>
4 0
3 years ago
Read 2 more answers
Other questions:
  • Jennifer has been hired as a temporary employee at a local college. She is given a username and password to access certain parts
    14·2 answers
  • The programs that provide the infrastructure and hardware control necessary for the computer and its peripheral devices are call
    11·1 answer
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • Which of the following is an example of new and emerging classes of software?
    11·1 answer
  • What is the 16-bit hexadecimal representation of each of the following signed decimal integers?
    13·1 answer
  • Write the function header (the first line of the function definition) to define a function named DisplayStats that accepts a str
    5·1 answer
  • How many answers do you need to be able to write messages on here??
    6·1 answer
  • A technician has been given a PC that is not powering up. After brief troubleshooting, the technician comes to the conclusion th
    14·1 answer
  • I need to know everything about lg fortune network unlocking or sim network unlock pin. Where, How, Which is best solution to do
    10·1 answer
  • Which of these allows the programmer to put data inside a variable?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!