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
Who invented the Graphical User Interface (GUI)?
Ludmilka [50]
The Graphical User Interface was invented by <span>Xerox PARC by </span>Alan Kay<span>, </span>Douglas Engelbart
5 0
3 years ago
What does module in Python do? How to install it? Thanks!
lyudmila [28]
A Python module is an extension file which contains programmable resources for a given translation unit. This is very much like a header file in C and C++, it's modularized data. For example, say I wanted to write a server/client script. I can't easily do so with Python out of the box. I would require the "socket" module which contains all of the functions, variables and data structures which allow for network programming.

network.py
___________
from socket import *

s = socket(AF_INET, SOCK_STREAM)
(...)
8 0
3 years ago
What two tabs does Outlook have that PowerPoint does not? View and Send/Receive Folder and Home Folder and Home Send/Receive and
grin007 [14]
<h2>What are the ribbon tabs in Microsoft Outlook?</h2>

The main Outlook menu has a ribbon tab with default commands. File, Home, Send/Receive, Folder, and View are commands on the main ribbon tab. The Backstage view is where you can see information and options pertaining to the user account and settings.

3 0
2 years ago
SOMEONE WHO ACTUALLY KNOW HOW TO DO THIS PLEASE DO IT AND SEND A SCREENSHOT I REALLY NEED IT FOR MY EXAMS AND DONT TROLL ​
vodka [1.7K]
What computer do you own?
8 0
2 years ago
_________ was demilitarized by Germany because of the Treaty of Versailles. The Rhineland The North Sea The Ruhr Valley Eastern
Alchen [17]

The Rhineland was turned into a demilitarized zone because of the Versailles Treaty.   -From 1919, Germany wanted to get rid of this zone because it left them open to attack from Belgium, Holland and France.   In March 1936, Germany's army occupied the Rhineland.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Is it better to meet online or offline<br> (Please answer QUICK)<br><br> Thanks :')
    5·2 answers
  • HELP ME!! <br> it’s a cross word, but I don’t know the answers, 25 points
    12·1 answer
  • Using a caesar cypher with an offset of three characters (a -&gt; d, b -&gt;e, ...., z -&gt; c), what would be the correct cyphe
    6·1 answer
  • In 2d design, form makes what possible?
    15·1 answer
  • 16 to 19 year old drivers are how many more times likely to crash? 1.7,2.7,0.7 ,3.7
    12·2 answers
  • Que es la felicidad??​
    12·1 answer
  • TRUE OR FALSE: THE BUILDER'S CLUB IS A PAID SUBSCRIPTION.
    9·2 answers
  • A computer _________________ is a text file that a computer can understand
    12·1 answer
  • I have the requirements for Ace rank on Brainly but hasn't given me it yet. Does it just take longer than normal ranks or someth
    15·2 answers
  • What option can be used by a system administrator to ensure that dynamic updates are made only by known clients when you have a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!