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
Rom4ik [11]
3 years ago
5

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.
Computers and Technology
1 answer:
kotegsom [21]3 years ago
6 0

Answer:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

Scanner in = new Scanner(System.in);

// Prompt user for an integer

       System.out.println("Please enter an Integer");

       int intNum = in.nextInt();

       // Prompt user for an double

       System.out.println("Please enter a double");

       double DoubleNum = in.nextDouble();

       // Prompt user for a character

       System.out.println("Please enter a Character");

       char charNum = in.next().charAt(0);

       // Prompt user for a String

       System.out.println("Please enter a String");

       String StringNum = in.next();

       System.out.println(intNum+" "+DoubleNum+" "+charNum+" "+StringNum);

   }

}

Explanation:

We import the Scanner class in order to receive user input. Then we create four different variables of type int, double,char and String to hold the values entered by the user.

To display the output on a single line, we use string concatenation (using the + operator) to acheive this.

You might be interested in
Dates of birth were entered into a computer program . The data was stored in the format DAY/MONTH/YEAR.The program rejected this
Marina CMI [18]

Answer:

i. This value was not accepted because we have 12 months and not 13.

ii. This is because the user entered the value for the day as value for the month.

Explanation:

i. Why was this not accepted?

This value was not accepted because we have 12 months and not 13. The user entered a value that was above the maximum value registered for the number of months in a year- which is 12.

ii. Why do you think this error occurred

This is because the user entered the value for the day as value for the month.

This could be because the user uses a date system different from that of the program.

3 0
3 years ago
The PadRight function has two parameters: S (a string) and N (an int), and returns as its result the string S padded on the righ
oee [108]

Answer:

The following code is written in python programming language:

def PadRight(S,N):   #define user defined function

 if(len(S)<N):    # set if condition

   S=S.ljust(N)   #set the space to right

   return S       # return the result

 

def PadLeft(S,N):    #define user defined function

 if(len(S)<N):    # set if condition

   S=S.rjust(N)   # set the space to left

   return S       # return the result

'''calling the function'''

print(PadLeft("Frog",7))

print(PadRight("Frog",7))

Output:

      Frog

Frog

Explanation:

Here, we define a user defined function "PadRight()" and pass two arguments in its parameter "S", "N".

Then, set the if condition and pass condition "len(S)<N" then, if the condition is true then the code inside the if condition set the space to right then, return the output.

After that, we again define a user defined function "PadLeft()" and pass two arguments in its parameter "S", "N".

Then, set the if condition and pass condition "len(S)<N" then, if the condition is true then the code inside the if condition set the space to right then, return the output.

6 0
3 years ago
Low-level formatting ____. Group of answer choices is different from physical formatting is usually performed by the purchaser o
Drupady [299]

Low-Level formatting is usually performed by the purchaser of the disk.

<h3>What is low-level formatting?</h3>

Low-Level formatting can be defined as is performed at the factory which electronically creates the hard drive tracks and sectors and tests for bad spots on a disk surface.

Low-level formatting is usually performed by the purchaser of the disk device.

Therefore, B is the correct option.

Learn more about Low-level formatting here:

brainly.com/question/13797778

#SPJ1

3 0
2 years ago
ASAP help me I dont have enough time
umka21 [38]

Answer:third stage of parent-infant attachment

Explanation:

7 0
2 years ago
I just want to say thanlouy for all the branlies on this app
Gnom [1K]

Answer:

that's just what we do :D

Explanation: because we're awesome UvU

7 0
3 years ago
Other questions:
  • Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.
    10·1 answer
  • Each computer or device on a network is called a(n) ______.
    7·1 answer
  • The following algorithm computes the average height for a list of basketball player heights. Initialize a variable sum to 0. For
    11·2 answers
  • Which of the following loop conditions will read all the data in the file assuming that each line in the file contains two integ
    5·1 answer
  • Which wireless communication technology is most likely used when synchronizing device information to an automobile?
    9·1 answer
  • What is the best way to show a complex data chart in word?
    6·1 answer
  • Supp guees how your dayyyyyyyyyyyy
    10·2 answers
  • CALLING ALL DEKUS UWU
    15·2 answers
  • How do I cancel and end my brainy subscription?
    11·2 answers
  • Which one do we use to send signals as IR light waves?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!