Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The Calculator (2 points) Write a function called squareNumber that will take one argument (a number), square that number, and return the result. It

image text in transcribed

1. The Calculator (2 points) Write a function called squareNumber that will take one argument (a number), square that number, and return the result. It should also log a string like "The result of squaring the number 3 is 9." Write a function called halfNumber that will take one argument (a number), divide it by 2, and return the result. It should also log a string like "Half of 5 is 2.5.". Write a function called percentof that will take two numbers, figure out what percent the first number represents of the second number, and return the result. It should also log a string like "2 is 50% of 4." Write a function called area0fCircle that will take one argument (the radius), calculate the area based on that, and return the result. It should also log a string like "The area for a circle with radius 2 is 12.566370614359172." 0 Bonus: Round the result so there are only two digits after the decimal. Write a function that will take one argument (a number) and perform the following operations, using the functions you wrote earlier1: 1. Take half of the number and store the result. 2. Square the result of #1 and store that result. 3. Calculate the area of a circle with the result of #2 as the radius. 4. Calculate what percentage that area is of the squared result (#3). 1. The Calculator (2 points) Write a function called squareNumber that will take one argument (a number), square that number, and return the result. It should also log a string like "The result of squaring the number 3 is 9." Write a function called halfNumber that will take one argument (a number), divide it by 2, and return the result. It should also log a string like "Half of 5 is 2.5.". Write a function called percentof that will take two numbers, figure out what percent the first number represents of the second number, and return the result. It should also log a string like "2 is 50% of 4." Write a function called area0fCircle that will take one argument (the radius), calculate the area based on that, and return the result. It should also log a string like "The area for a circle with radius 2 is 12.566370614359172." 0 Bonus: Round the result so there are only two digits after the decimal. Write a function that will take one argument (a number) and perform the following operations, using the functions you wrote earlier1: 1. Take half of the number and store the result. 2. Square the result of #1 and store that result. 3. Calculate the area of a circle with the result of #2 as the radius. 4. Calculate what percentage that area is of the squared result (#3)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

8. Explain the contact hypothesis.

Answered: 1 week ago

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago