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
posledela
3 years ago
15

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:
UNO [17]3 years ago
6 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
how can you turn on a light switch and it not work, without turning off the power to the whole house?
vitfil [10]

Answer:

Go to the beaker box and turn off the power to that one room. Duh

Explanation:

6 0
3 years ago
It is a part of webpage that contains the logo ang branding of the web page​
Novay_Z [31]
The answer is Header/Banner
6 0
3 years ago
Excerpt from "How Prepared Are Students for College Level Reading? Applying a Lexile-Based Approach."
Verizon [17]

Answer: Students graduating from high school are not prepared for college-level work.

Explanation:

From the excerpt, it was written that there is a high rates of enrollment in remedial college courses which shows that there are many students are graduating from high school who are unprepared for college-level work.

Therefore, based on this, the best summary of the paragraph is that the students graduating from high school are not prepared for college-level work.

Therefore, the correct option is C.

7 0
3 years ago
PHOTOGRAPHY
Natasha_Volkova [10]

Answer:

false

Explanation:

when you zoom in it mkes it bigger and closer not smaller and farther

hope this helps :)

8 0
3 years ago
Read 2 more answers
Of the measures of feasibility, questions such as "Does the proposed platform have sufficient capacity for future needs?" and "W
larisa [96]
Operational feasibility !!!!!!!
8 0
4 years ago
Other questions:
  • Waterpower was first harvested by ancient societies using
    5·1 answer
  • Select the correct answer. Rachel needs to make a presentation on ethics and etiquettes in college. She has about 30 minutes to
    13·1 answer
  • If you touch a downed power line covered or bare, what’s the likely outcome?
    10·2 answers
  • What is the difference in adware and spyware
    11·2 answers
  • What is a row of data in a database called?<br> Field<br> File<br> Record<br> Title
    10·1 answer
  • Which resource hels a user access a could service​
    12·1 answer
  • When was the federal commission act put into effect?????
    13·1 answer
  • The best way to access the Windows Help and Support Center is _____.
    10·1 answer
  • Which of the following tasks will save a file over top of itself, using the same filename? A. Reload B. Save C. Save As D. Expor
    13·1 answer
  • ______design A plan for the actual implementation of the system.
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!