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
julsineya [31]
4 years ago
13

A variable like userNum can store a value like an integer. Extend the given program to print userNum values as indicated. (1) Ou

tput the user's input.Enter integer: 4 You entered: 4(2) Extend to output the input squared and cubed. Hint: Compute squared as userNum * userNum. (Submit for 2 points, so 4 points total).Enter integer: 4 You entered: 44 squared is 16 And 4 cubed is 64!!(3) Extend to get a second user input into userNum2. Output sum and product. (Submit for 1 point, so 5 points total).Enter integer: 4 You entered: 44 squared is 16 And 4 cubed is 64!! Enter another integer: 5 4 + 5 is 9 4 * 5 is 20import java.util.Scanner;public class OutputWithVars {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int userNum = 0;System.out.println("Enter integer: ");userNum = scnr.nextInt();return;}}
Computers and Technology
1 answer:
Olin [163]4 years ago
4 0

Answer:

Write the following lines of code just before the return statement

//1

       System.out.println("You entered "+userNum);        

       // 2

       System.out.println(userNum+" squared is "+(Math.pow(userNum, 2))+" and "+userNum+" cubed is "+(Math.pow(userNum, 3)));

       //3

       int userNum2 = 0;

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

       userNum2 = scnr.nextInt();

int sum = userNum + userNum2;

       System.out.println(userNum+" + "+userNum2+" is "+sum);

int product = userNum * userNum2;

       System.out.println(userNum+" * "+userNum2+" is "+product);

Explanation:

I continued the program from where you stopped in the question

The explanation has been added as an attachment

Download docx
You might be interested in
Xxx<br>uuuuuu<br>uuuu<br>jjnmn<br>jjh
Leviafan [203]
Answer: What’s this??
7 0
3 years ago
Every character, number, or symbol on the keyboard is represented as a _____ in computer memory.
Lorico [155]
Every character, number, or symbol on the keyboard is represented as a binary number in computer memory.
3 0
3 years ago
Read 2 more answers
Select the statements that describe Windows® desktops.
antoniya [11.8K]

Answer:

The Recycle Bin is a common desktop feature.

Shortcuts to frequently used programs can be added.

5 0
3 years ago
Read 2 more answers
A technician is troubleshooting an employee laptop that has a wired network connectivity issue. The laptop can connect to the in
defon

By Tx/Rx reverse the technician can address this issue.

C. Tx/Rx reverse

<u>Explanation:</u>

Technician has to trouble the laptop, since the laptop is connected and got internet while is the network resources inside the office. But if he connects the same laptop in research lab end user is not connected

Following troubleshooting to made

1. Routing is done properly

2. Any packet dropping by using TRACE command in windows operating system.

Since DHCP is used in office, whereas same type is not used in research lab. End user can try TX/RX reverse cable to connect in the research laptop.

5 0
4 years ago
3. Windows that are viewed as Web pages have<br> sections. **
tankabanditka [31]

Answer:

when the when the when the add the when are you is id god his gay for your top off jack dafe cafe read line green red whats the answer

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • In traditional programming, probably the most often used error-handling outcome was to ____.
    15·1 answer
  • Data silos are often associated with ________________.
    12·1 answer
  • For an alternative to the String class, and so that you can change a String's contents, you can use_________ .
    12·1 answer
  • Software that interprets commands from the keyboard and mouse is also known as the
    15·2 answers
  • Now suppose that the file is broken into 5 packets, each of 10 Mbits. Ignore headers that may be added to these packets. Also ig
    14·1 answer
  • Which describes the first step a crawler-based search engine uses to find information?
    10·2 answers
  • Someone pleaseee answer my last question i just posted ;-;
    6·2 answers
  • Which of the following is not a valid C language<br>int​
    6·1 answer
  • A sum amounts to ₹2400 at 15% simple interest per annum after 4 years fond the sum.​
    9·1 answer
  • Task queues, which allow for asynchronous performance, are an important part of modern processing architectures. Information abo
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!