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
Which of the following software is an
krok68 [10]
The answer is B:McAfee
3 0
3 years ago
Read 2 more answers
When is an original work considered Public Domain? A. When posted via social media. B. When is it posted on the internet C. When
I am Lyosha [343]
<span>Best Answer is (D)
</span>

Any<span> materials not protected by copyright, patent laws or trademark are referred to as copyright. Generally, the public owns these works, and anyone is allowed to use public domain works without obtaining permission. There are various common ways that these works may end up arriving in the public domain. One of those ways includes the expiration of copyright. The copyright owner may also fail to follow renewal rules that govern copyright. </span>The copyright owner may as well decide to place his or her works deliberately in the public <span>domain.</span>

3 0
3 years ago
Which html attributes are required in the image () element - check as many as apply
kotykmax [81]

Answer:

The correct answer for the given question is option(3) i.  src.

Explanation:

In HTML if we insert a image on the screen we use<img> tag

the img have following attribute

1.src

2.height.

3 alt

4 width

The required attribute in img tag is src i.e source or path of image

The following are the syntax of image tag

<img src=" path of image" alt="not visible"  height="100px" width="100px"/>

The height and width attribute describe the height and width of image in pixel.

The alt attribute is not mendatory attribute in image tag.The alt attribute display the message when image is not visible in the web page .

All the other attribute like alt,height,width are used as per the requirement but src is an required attribute .

so the option(3) is correct.

6 0
3 years ago
I have an IPhone 8plus 64gb... should I get another phone like samsung note 9 or s9 ??
laiz [17]

Nah, I think the IPhone would be better than them both


7 0
3 years ago
How do productivity programs most benefit the way we work and live?
finlep [7]

Answer:

They provide us with ways to communicate, display, and work with information more quickly and accurately.

Explanation:

Productivity programs helps in the provision of information and they also help in increasing productivity by making work less stressful and unambiguous. Examples of productivity programs include design programs and spreadsheet tools.

These programs also create an avenue for providing us with ways to communicate, display and work with information more quickly and accurately.

6 0
3 years ago
Other questions:
  • An operating system can be categorized according to: question 1 options:
    8·2 answers
  • Which smb share option should you enable if you don't want users to see files they don't have at least read permission to?
    9·1 answer
  • Select Packet 10 in the Wireshark top pane and then answer the following questions: Did this handshake complete properly? What i
    7·1 answer
  • Can u suggest me some Hindi movies that is on you-tube please suggest
    7·2 answers
  • What is the function of a header when writing HTML
    10·1 answer
  • Which of the following is NOT a destination?
    12·2 answers
  • If a*b = 2a - 56, calculate the value of<br>3 * 4​
    14·1 answer
  • You are utilizing BitLocker Drive Encryption, and are attempting to update Windows Server 2016. What must be done so that the up
    14·1 answer
  • What might a designer need to consider when choosing an appropriate energy source for products and power systems
    15·1 answer
  • Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!