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
natita [175]
2 years ago
9

A variable like user_num can store a value like an integer. Extend the given program as indicated. Output the user's input. (2 p

ts) Output the input squared and cubed. Hint: Compute squared as user_num * user_num. (2 pts) Get a second user input into user_num2, and output the sum and product. (1 pt)
Computers and Technology
1 answer:
lapo4ka [179]2 years ago
7 0

Answer:

The answer to this question is given below in the explanation section. It is noted that this program is written in C++ using online C++ compiler.

Explanation:

#include <iostream>

using namespace std;

int squared(int num)// this is the function to compute square

   {

       return num*num;

   }

int cube(int num)// this is the function to compute cube

   {

       return num*num*num;

   }

int main()

{

   int user_num, user_num2; // variable declaration

   

       cout<<"Enter the first number: ";//prompt user to enter the number

       cin>>user_num;//store the user entered number into variable

       cout<<"\nEnter the second number: ";//prompt the user to enter the second number

       cin>>user_num2;//store the user entered number into variable

   

   

   cout<<"\nSquared of first number is: "<<squared(user_num);//compute square of user_num and display

   cout<<"\nCube of first number is: "<<cube(user_num);//compute the cube of the user_num and display

   cout<<"\nSquare of second number is: "<<squared(user_num2);//compute the square of user_num2 and display

   cout<<"\nCube of second number is: "<<cube(user_num2);//compute the cube of user_num2 and display

   

   cout<<"\nSum of number 1 and number 2 is: "<<user_num2 + user_num2;//display the sum of user_num2 and user_num

   cout<<"\nProduct of number 1 and number 2 is: "<<user_num2 * user_num;//display the product of user_num and user_num2

   

   

   return 0;//terminate the program

}

                               

You might be interested in
int) You are the head of a division of a big Silicon Valley company and have assigned one of your engineers, Jim, the job of dev
sergeinik [125]

Answer:

Correct option is E

Explanation:

a) 2n^2+2^n operations are required for a text with n words

Thus, number of operations for a text with n=10 words is 2\cdot 10^2+2^{10}=1224 operation

Each operation takes one nanosecond, so we need 1224 nanoseconds for Jim's algorithm

b) If n=50, number of operations required is 2\cdot 50^2+2^{50}\approx 1.12589990681\times 10^{15}

To amount of times required is 1.12589990681\times 10^{15} nanoseconds which is

1125899.90685 seconds (we divided by 10^{9}

As 1$day$=24$hours$=24\times 60$minutes$=24\times 60\times 60$seconds$

The time in seconds, our algortihm runs is \frac{1125899.90685}{24\cdot 60\cdot 60}=13.0312 days

Number of days is {\color{Red} 13.0312}

c) In this case, computing order of number of years is more important than number of years itself

We note that n=100 so that 2(100)^2+2^{100}\approx 1.267650600210\times 10^{30} operation (=time in nanosecond)

Which is 1.267650600210\times 10^{21} seconds

So that the time required is 1.4671881947\times 10^{16} days

Each year comprises of 365 days so the number of years it takes is

\frac{1.4671881947\times 10^{16}}{365}=4.0197\times 10^{13} years

That is, 40.197\times 10^{12}=$Slightly more than $40$ trillion years$

4 0
2 years ago
On a webpage, a _____ provides supplemental material such as social networking feeds and ads. Group of answer choices footer sid
finlep [7]

Answer:

sidebar

Explanation:

The part of the webpage that is being described in this question is known as a sidebar. These are the far left/right sides of the webpage and are usually used for networking feeds, ads, related information, major points of the main page, biographical info, as well as persuasive information. This section of the webpage serves two main purposes to provide the viewer with advertisements and to encourage the reader to read the more detailed main article.

8 0
2 years ago
Consider a single-platter disk with the following parameters: rotation speed: 7200 rpm; number of tracks on one side ofplatter:
horsena [70]

Answer:

Given Data:

Rotation Speed = 7200 rpm

No. of tracks on one side of platter = 30000

No. of sectors per track = 600

Seek time for every 100 track traversed = 1 ms

To find:

Average Seek Time.

Average Rotational Latency.

Transfer time for a sector.

Total Average time to satisfy a request.

Explanation:

a) As given, the disk head starts at track 0. At this point the seek time is 0.

Seek time is time to traverse from 0 to 29999 tracks (it makes 30000)

Average Seek Time is the time taken by the head to move from one track to another/2

29999 / 2 = 14999.5 ms

As the seek time is one ms for every hundred tracks traversed.  So the seek time for 29,999 tracks traversed is

14999.5 / 100 = 149.995 ms

b) The rotations per minute are 7200

1 min = 60 sec

7200 / 60 = 120 rotations / sec

Rotational delay is the inverses of this. So

1 / 120 = 0.00833 sec

          = 0.00833 * 100

          = 0.833 ms

So there is  1 rotation is at every 0.833 ms

Average Rotational latency is one half the amount of time taken by disk to make one revolution or complete 1 rotation.

So average rotational latency is: 1 / 2r

8.333 / 2 = 4.165 ms

c) No. of sectors per track = 600

Time for one disk rotation = 0.833 ms

So transfer time for a sector is: one disk revolution time / number of sectors

8.333 / 600 = 0.01388 ms = 13.88 μs

d)  Total average time to satisfy a request is calculated as :

Average seek time + Average rotational latency + Transfer time for a sector

= 149.99 ms + 4.165 ms + 0.01388 ms

= 154.168 ms

4 0
1 year ago
When should a developer begin thinking about scalability? 1 during the design phase 2during testing 3when traffic increases by 2
Tanzania [10]

Answer:

in my opinion 4

Explanation:

when the system is available to users

(sorry and thanks)

4 0
1 year ago
Suppose your company has decided that it needs to make certain busy servers faster. Processes in the workload spend 60% of their
vekshin1

Answer:

CPU need 50% much faster

disk need 100% much faster

Explanation:

given data

workload spend time CPU  = 60%

workload spend time I/O = 40%

achieve overall system speedup = 25%

to find out

How much faster does CPU need and How much faster does the disk need

solution

we apply here Amdahl’s law for the overall speed of a computer that is express as

S = \frac{1}{(1-f)+ \frac{f}{k} }      .............................1

here f is fraction of work i.e 0.6 and S is overall speed  i.e 100% + 25% = 125 % and k is speed up of component

so put all value in equation 1 we get

S = \frac{1}{(1-f)+ \frac{f}{k} }  

1.25 = \frac{1}{(1-0.6)+ \frac{0.6}{k} }  

solve we get

k = 1.5

so we can say  CPU need 50% much faster

and

when f = 0.4 and S = 125 %

put the value in equation 1

S = \frac{1}{(1-f)+ \frac{f}{k} }  

1.25 = \frac{1}{(1-0.4)+ \frac{0.4}{k} }  

solve we get

k = 2

so here disk need 100% much faster

7 0
1 year ago
Other questions:
  • When a typeface does not have any extra embellishments on the top and bottom of the letterforms, it is called a ________ font?
    12·1 answer
  • Jenny has to include the image of a sun on one of her slides. She needs to write relevant text about it on a dark background on
    6·1 answer
  • Which of the following is an Internet supervisory protocol? O DNS IP O both A and B O neither A nor B
    12·1 answer
  • Write a method called printReverse that accepts a String as its parameter and prints the characters in opposite order. For examp
    9·1 answer
  • Choose the attribute used to provide accessibility by configuring a text alternative that is available to browsers and other use
    14·1 answer
  • 10. (P37) Compare GBN, SR, and TCP (no delayed ACK). Assume that the timeout values for all three protocols are sufficiently lon
    12·1 answer
  • Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
    11·1 answer
  • The elements of an integer-valued array can be initialized so that a[i] == i in a recursive fashion as follows: An array of size
    10·1 answer
  • Krista needs to configure the default paste options in PowerPoint 2016. Which area of the Options dialog box will she need to us
    14·1 answer
  • The PictureBook class is a subclass of the Book class that has one additional attribute: a String variable named illustrator tha
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!