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
6.5 Code Practice: Question 1
vaieri [72.5K]

Answer:

# input the number of temperatures required, which will be 10 here, but the user can print any number.

n=input("Enter the number of temperatures you want")

# create a list which can have n temperatures since it starts from 0, the maximum is n-1, and n needs to be converted to an integer.

temp= [0,int(n)-1]

#declared a variable of float type. As its 0.0 it will be a float, if 0 then integers, and so on

s=0.0

#running a for loop n times, and hence 0 to n-1.

for i in range(0, int(n)):

temp[i]=input("Enter the temperature in degree celsius in float")

s=s + float(temp[i])

i=i+1

print("The sum of the temperatures is:{0:0.1f}", +s)

Explanation:

The question from edhesive is: You need to write a program that calls for ten temperatures and then find the sum of temperatures. The temperature should be in float, which is expected. And the program is as being mentioned in the answer section.

4 0
3 years ago
Read 2 more answers
Which of the following has allowed computers to have more memory capabilities without making them extremely expensive Virtual me
lina2011 [118]

Virtual memory may provide a reasonably large storage capacity in an affordable cost.

<u>Virtual Memory:</u> the operating systems of all modern computers have virtual memory where a disk is used to transfer the data temporarily from the RAM when physical memory of the computer falls short. Though it is cheap but it does not allow computers to have more memory and frequent swapping even makes the PC slow.

<u>Tiered memory:</u> has the fastest data storage and even has a good storage capacity but is pretty expensive.

<u>Volatile memory:</u> volatile memories have good performance in terms of speed and storage but they still are a little expensive in comparison to non-volatile memory.

<u>Non-volatile memory:</u> they do not provide with large storage capacities.

7 0
3 years ago
Can anybody do Algorithm 2 for me (with Python).<br> Answer = 25 points.
Nostrana [21]

Answer:

age=int(input("Enter age"))

if age>=18:

    print("You are Young")

else

   print("You are child")

Explanation:

if you have any query or any problem kindly ask in comment

5 0
3 years ago
This is going to get taken down but I dont care add me on discord cause ima bored<br> -Red-#9847
Alex777 [14]

Answer:

I WILL

Explanation:

6 0
2 years ago
Which is true about TCP and UDP? Choose two answers.
vichka [17]

Answer:

TCP is a connection-oriented protocol

UDP does not acknowledge a receipt of data

Explanation:

TCP (Transmission Control Protocol) is a protocol to transfer data, this is one of the most important protocols on the entire internet, this method was implemented from the beginning of the network.

UDP (User Datagram Protocol) this is a protocol faster than TCP because this method doesn't establish a connection to sent data, in this case, always sent data, but TCP is more secure than UDP, and for that UDP is used to transfer music or videos, and TCP websites and database.

UDP doesn't need acknowledgment is done by UDP, is only concerned with speed.

7 0
3 years ago
Other questions:
  • Which of the following can be sources of sediment? A. fragments of other rocks B. chemicals and minerals dissolved in water C. s
    11·1 answer
  • Using a wireless network without the network owner's permission is known as ________.
    15·1 answer
  • An employee who interacts with customers regarding the nature of their car problems, rather than actually working on the vehicle
    12·2 answers
  • What is the standard internet protocol, which provides the technical foundation for the public internet?
    9·1 answer
  • You have added a table to your web page consisting of two columns and five rows, including the header row. in the first header c
    13·1 answer
  • What connectors are available for components to be connected externally to the motherboard
    12·2 answers
  • 8. A sprite is a simple spider shaped thing with n legs coming out from a center point. The angle
    10·1 answer
  • Leon needs to configure the days and times of his work week for his Outlook Calendar. Which option should he
    12·2 answers
  • a ____ is a window inside the word window that can remain open and visible while you work in a document.
    14·1 answer
  • When an EC2 instance is being modified to have more RAM, is this considered Scaling Up or Scaling Out?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!