answer.
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
2 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]2 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
Each of these is a basic type of a touch screen, except ________.
Oksanka [162]
<span>A touch screen gives response and acts simply with a touch on the screen area. Reflective screen is not a basic type of touch screen. The reflection can be reduced for the touch screen when it is combined with the LCD and the screen still be very visible. These screens can be anti glare and safe to the eyes.</span>
8 0
2 years ago
Read 2 more answers
A small e-commerce company uses a series of Robotic Process Automation solutions to manage the backup of data from individual wo
Vaselesa [24]

Answer:

Cloud.

Explanation:

Cloud computing can be defined as a form of data computing which requires the use of shared computing resources such as cloud storage (data storage), servers, computer power, and software over the internet rather than local servers and hard drives.

Generally, cloud computing offer individuals and businesses a fast, secured, effective and efficient way of providing services over the internet.

Basically, cloud computing comprises three (3) service models and these include;

1. Platform as a Service (PaaS).

2. Software as a Service (SaaS).

3. Infrastructure as a Service (IaaS).

Additionally, the two (2) main characteristics of cloud computing are;

I. Measured service: it allows cloud service providers to monitor and measure the level of service used by various clients with respect to subscriptions.

II. Resource pooling: this allows cloud service providers to serve multiple customers or clients with services that are scalable and provisional.

For example, the provisioning of On-demand computing resources such as storage, network, virtual machines (VMs), etc., so as to enable the end users install various software applications, database and servers.

Hence, the technology that could be combined by the small e-commerce company with its current automated processes is cloud storage.

9 0
2 years ago
Sam’s password is known to be formed of 3 decimal digits (0-9) in a given order. Karren and Larry are attempting to determine Sa
prohojiy [21]

Answer:

100

Explanation:

7 0
2 years ago
Read 2 more answers
Allows you to manually add an entry to the arp cache that resolves the ip address inetaddr to the physical address etheraddr. wh
Norma-Jean [14]
The answer in this question is that once the Adaptor or router received the destination IP address (even if we entered in the incorrect MAC address) the router or adapter would remove the IP address from the Ethernet frame and using ARP, would get the correct MAC address of the destination.
6 0
2 years ago
Which decimal value (base 10) is equal to the binary number 1012?
GaryK [48]

Answer:

The decimal value of 101₂² base 2 = 25 base 10

Explanation:

The number 101₂² in decimal value is found as follows;

101₂ × 101₂ = 101₂ + 0₂ + 10100₂

We note that in 101 + 10100 the resultant 2 in the hundred position will have to be converted to a zero while carrying over 1 to the thousand position to give;

101₂ + 0₂ + 10100₂ = 11001₂

Therefore;

101₂² =  11001₂

We now convert the result of the square of the base 2 number, 101², which is 11001₂ to base 10 as follows;

Therefore converting 11001₂ to base 10 gives;

11001₂= 1 × 2⁴ + 1 × 2³ + 0 × 2² + 0 × 2 ¹ + 1 × 2⁰

Which gives;

16 + 8 + 0 + 0 + 1 = 25₁₀.

7 0
2 years ago
Other questions:
  • Steps in creating a folder
    12·1 answer
  • 1.2.2: Output variable value. Jump to level 1 Write a statement that outputs variable userAge. End with a newline. 1 2 3 4 5 6 7
    12·1 answer
  • When a program has several modules calling other modules, programmers often use a program ____, which operates similarly to an o
    5·1 answer
  • In this exercise, you will create a couple of helper methods for ArrayLists in a class called ArrayListMethods.
    10·1 answer
  • You are using a polynomial time 2-approximation algorithm to find a tour t for the metric traveling salesman problem. Which of t
    7·1 answer
  • For his class project, Matt has to create an image in a color scheme that has shade or tint variations of the same hue. Which co
    7·1 answer
  • A program is divided into 3 blocks that are being compiled on 3 parallel computers. Each block takes an Exponential amount of ti
    6·1 answer
  • Which of the following statements is true regarding ARPANET? Select 3 options. It was a product of Bell Laboratories and was int
    9·1 answer
  • What measures are needed to trace the source of various types of packets used in a DoS attack? Are some types of packets easier
    14·1 answer
  • 1-(50 points) The function sum_n_avgcomputes the sum and the average of three input arguments and relays its results through two
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!