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
Having plug and play support means you can plug in a device, turn on the computer, and then immediately begin using the device t
fenix001 [56]
<span>True. The owner does not need to install any new drivers for the device to work, and they do not have to let the computer know that a new device has been connected. They simply can plug it in, and it will be ready to use.</span>
4 0
3 years ago
SLA:
Sphinxa [80]

Answer:

Objective

1 . b

2.a

3.b

4.a

5.a

6.b

7.a

8.b

9.a

10.a

8 0
3 years ago
How did AI help in creating the Cognitive dress for Marchesa?
jeka94

Answer: The Technology helped in developing a gown or dress for Marchesa to enable them be an integral part of their business both now and the future.

Explanation:

solution

The dress lit up in many colors with regards on the sentiment of tweets about the dress. tweets were passed through a Watson tone analyzer and then sent back to a small computer  that was inside the waist of the dress.

Because social media is an important part of their business, the Marchesa team loved how Watson could integrate that information into the beauty of the gown.

The technology was seen as a threat at first for both and Georgina and Keren, who concluded that she “can barely turn on her computer.” After successfully absorbing  it into the gown, they are very welcoming towards the technology and love how simple it made the design process and other functions of business.

3 0
4 years ago
Jessica has a balance of $2,200 on her credit card with an 18% interest rate. Her credit card company doesn’t require a minimum
professor190 [17]
By doing 2200/18 you get 122 which is how many times you can have 18 go into 2200 and its also how long it will take in days to get her balance doubled.
3 0
4 years ago
A resistor is marked with the following color bands: brown, black, red, and silver. What is the resistance of this resistor? A.
Montano1993 [528]
A. 1,000 is the answer hope this helps
3 0
3 years ago
Read 2 more answers
Other questions:
  • Mile markers appear as _____ green signs.
    6·2 answers
  • What is a project manager?
    6·2 answers
  • HELP ME WITH JAVA: This is my assignment. I need to write a program with a main method and methods. Use a scanner to get the Str
    5·1 answer
  • Secure Multipurpose Internet Mail Extensions builds on the encoding format of the MIME protocol and uses digital signatures base
    15·1 answer
  • The 'parseInt' method of the 'Integer' class throws a 'NumberFormatException' when it is passed a String argument that it cannot
    11·1 answer
  • ___________ system allows us to talk to any person in the world it any time​
    15·2 answers
  • If you were writing a story set in our time, what would you include to give readers a sense of our world? Check any that apply.
    5·1 answer
  • Consider an allocator on a 32-bit system that uses an implicit free list. Each memory block, either allocated or free, has a siz
    11·1 answer
  • Apart from mATX and ATX what are the other form factors of power supply
    7·1 answer
  • Which device allows users to directly hear data from a computer
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!