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
A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
uysha [10]

Answer:

Security Tab is the correct answer.

Explanation:

The Security Tab will enable the users to authorize anyone to use that file or directory.Many clients deleted the security tab because After that nobody can alter the security privileges on the device.

  • With the help of the Security tab, we will minimize the ActiveX attacks on Internet Explorer. This option is available in the Internet Options of the dialog box.
  • Other options are incorrect because they are not related to a given scenario.
8 0
3 years ago
How many owners does a sole proprietorship have?
never [62]
The sole proprietorship it is the simplist business form under which one can operate a business. the answer is one.
8 0
3 years ago
If every element of a list must beprocessed, a(n) __________is more efficient than a(n)______.
statuscvo [17]

Answer:

B - array; hash

Explanation:

Arrays store elements of the same data type in a list. Every element in the array is assigned a unique integer (starting at 0). You are able to access/process an element by using its assigned integer. Hashes are similar in the fact that they also store data. The difference is that each element is assigned an object type (instead of an integer), making it a collection of key pairs, as such you would typically not use this to process elements efficiently.

6 0
3 years ago
Write an if statement that prints the message “Application accepted” if the variable workExperience is greater than or equal to
katovenus [111]
If workExperience >= 2 or CollegeDegree is true:
print “Application accepted”
else:
print “Application denied”

4 0
3 years ago
Read 2 more answers
The five major functional areas consist of the Command Staff as a whole and the four sections in the General Staff: Operations,
inn [45]

The five major functional areas consist of the Command Staff as a whole and the four sections in the General Staff: Operations, Planning, Logistics, and Finance and Administration. Of these, the planning section consists of resource unit, situation unit, demobilization unit, and the documentation unit.

<u>Explanation:</u>

The Resource unit looks after the allocation, analysis, and organization of resources.

The situation unit collects information about The status of a particular incident that takes place in an organization.

The Demobilization unit is responsible for preparing a demobilization plan. It is responsible for the safety of persons and machines in case of any incident.

The Documentation unit looks after all the documents and prepares them on time.

8 0
3 years ago
Other questions:
  • Discuss in detail why you need to use a write blocker (either hardware or software) in your examinations, whether for a criminal
    6·1 answer
  • Suppose the length of each packet is L bits. Also, assume the path from a server to a client includes N links each of rate R (i.
    8·1 answer
  • #Write a function called "replace_all" that accepts three #arguments: # # - target_string, a string in which to search. # - find
    11·1 answer
  • i have a class for computers and i need a free hardrive are there any websites that give me one for free in 3 days??​
    15·1 answer
  • ........ is a formal description of message formats and the rules for exchanging those messages
    12·1 answer
  • Read the following scenario:
    7·2 answers
  • Select the correct answer.
    15·1 answer
  • You are critiquing a logo design that one of your coworkers proposed. Your sense is that the individual elements of the design a
    10·1 answer
  • Digital censorship uses automated, intelligent systems with big data storage to _____. Select 3 options.
    13·2 answers
  • What file can you edit on a linux system to configure shared folders using samba?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!