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
KonstantinChe [14]
3 years ago
11

(1) Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output

those four values on a single line separated by a space. (2 pts) Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs. Enter integer: 99 Enter double: 3.77 Enter character: 2 Enter string: Howdy 99 3.77 z Howdy (2) Extend to also output in reverse (1 pt) Enter integer: 99 Enter double 3.77 Enter characteri Enter string: Howdy 99 3.772 Howdy Howdy z 3.77 99 (3) Extend to cast the double to an integer, and output that integer (2 pts) 0 en soa Enter integer: 99 Enter double: 3.77 Enter character: 2 Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 3.77 cast to an integer is 3 LAB ACTIVITY 14.1.1: Prog 1: Variables, input, and casting 0/5 BasicInput.java Load default template. 1 ort java.util.Scanner: 2 3 lic class Basic Input I 4 public static void main(String args) { 5 Scanner ser-new Scanner(System.in); 6 int userint; 7 double userDouble; B // FTOME Define chor and string variables similarly 9 char UserChar: 10 String userString: 11 12 System.out.println("Enter integer"): 13 user Int - ser.nextInto: 14 15 // FTXMC (1): Finish reading other items inte variables, then output the four values on a single line separated by a space
Computers and Technology
1 answer:
Alex787 [66]3 years ago
6 0

Answer:

import java.util.*;

public class Main{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 int intgVal; double dblVal; char chrVal; String strVal;

 System.out.print("Enter integer: ");  

 intgVal = input.nextInt();

 System.out.print("Enter double: ");  

 dblVal = input.nextDouble();

 System.out.print("Enter character: ");  

 chrVal = input.next().charAt(0);

 input.nextLine();

 System.out.print("Enter string: ");  

 strVal = input.nextLine();

 System.out.println(intgVal+" "+dblVal+" "+chrVal+" "+strVal);

 System.out.println(strVal+" "+chrVal+" "+dblVal+" "+intgVal);

 int IntValue = (int) dblVal;

 System.out.print("Cast to an integer: "+IntValue);

}

}

Explanation:

See attachment for complete program where comments were used to explain each line of the program

Download txt
You might be interested in
You can use the ____ to change the order of the wat windows are stacked.
djyliett [7]

Answer:

A

Explanation:

6 0
3 years ago
To make a drop shadow larger what should you change about the drop shadow in gimp
vlabodo [156]
To Change the Drop Shadow Just Go to effects on the photo go to drop shadow than change the spread and Distinse and Opasity.
4 0
3 years ago
Help please what is the answer , thanks!!!
shepuryov [24]

Answer:

X = "Hello World"

Y = "hello world"

Z = 100

C = 200

if X == Y:

   print("TRUE")

else:

   print("FALSE")

if Z > C:

   print("TRUE")

else:

   print("FALSE")

4 0
3 years ago
What are the basic problem that my pc can have?
Lena [83]
A virus, malware, unplugged, used too much storage, etc.
5 0
3 years ago
Pls can anyone be so kind and answer this question.....i need the answer urgently
mixas84 [53]

Answer:

so u have to be smaet

Explanation:

8 0
2 years ago
Other questions:
  • What is the best free game designing program for windows
    5·1 answer
  • Name two purposes of creating a microsoft account for use in visual studio 2015
    12·1 answer
  • How can you create the first row of the table as the header of the table?
    14·2 answers
  • The level of competition is an important factor for many people when selecting a physical activity.
    7·2 answers
  • Visual-verbal synergy has nothing to do with text, but solely with images used in a design.
    9·1 answer
  • What is the output of the following function call? //function body int factorial(int n) { int product=0; while(n > 0) { produ
    12·1 answer
  • What is application launchers functions​
    15·1 answer
  • The Internet was first used by which of the following institutions?
    7·1 answer
  • What is a common use for append queries?
    14·2 answers
  • An information system can enhance core competencies by
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!