Write a bash script that creates an array of shapes - square, rectangle, triangle, and circle....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a bash script that creates an array of shapes - square, rectangle, triangle, and circle. The script prompts the user to enter to select one of these shapes. Based on the shape, it should prompt the user for the necessary value to calculate the area of the shape selected. The script should then display the value calculated. (Use: 3.14 for pi) Area of Square= side² = side x side Area of Rectangle = length x width 1 Area of Triangle = = x base x height Area of Circle = πxr² = πxr xr The interface should be as follows: Enter a shape [square, rectangle, triangle, and circle]: square Enter the measurement of the side: 8 Area of square = 64 Enter a shape [square, rectangle, triangle, and circle]: rectangle Enter the measurement of the length: 8 Enter the measurement of the width: 3 Area of square= 24 Write a bash script that creates an array of shapes - square, rectangle, triangle, and circle. The script prompts the user to enter to select one of these shapes. Based on the shape, it should prompt the user for the necessary value to calculate the area of the shape selected. The script should then display the value calculated. (Use: 3.14 for pi) Area of Square= side² = side x side Area of Rectangle = length x width 1 Area of Triangle = = x base x height Area of Circle = πxr² = πxr xr The interface should be as follows: Enter a shape [square, rectangle, triangle, and circle]: square Enter the measurement of the side: 8 Area of square = 64 Enter a shape [square, rectangle, triangle, and circle]: rectangle Enter the measurement of the length: 8 Enter the measurement of the width: 3 Area of square= 24
Expert Answer:
Answer rating: 100% (QA)
Heres the Bash script that creates an array of shapes prompts the user to select one and calculates ... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
1. In any case, a plaintiff must establish standing to sue. That means they must have suffered an actual harm and the harm must be redressable. Think about why this standing requirement exists....
-
Prove the following functions are primitive recursive: Quotient of two numbers: if x, y = N then quo(x, y) = such that x = y*z+r where 0 r
-
As the COVID-19 pandemic accelerated the shift to online grocery shopping, also known as e-grocery or grocery commerce, many grocery retailers outsourced their e-grocery deliveries to third-party...
-
1. Let f(x) = 2x+6 if x < -1 3x+2 if x -1 (a) What is lim, -1- f(x)? Your answer will depend on b. (b) What is lim,-1+ f(x)? (c) For what values of b does limx-1 f(x) exist? 2. Suppose that f and g...
-
CIBC's return on assets was 0.7%. During the same year, CIBC reported a return on common shareholders' equity of 19.2%. Has CIBC made effective use of leverage? Explain.
-
Reliable Auto Parts, Inc., completed the following selected transactions during 2016: Jan 17 Sold inventory to Bill Sinson, $800, on account. Ignore cost of goods sold. Jun 29 Wrote off the Bill...
-
Most balance sheets are defined as classified balance sheets in that both the assets and liabilities are dichotomized into the categories of current and noncurrent. [In those industries in which the...
-
EasyWriter manufactures an erasable ballpoint pen, which sells for $1.75 per unit. Management recently finished analyzing the results of the companys operations for the current month. At a break-even...
-
Why might discounted cash flow valuation be difficult to do for the following types of firms? A private firm, where the owner is planning to sell the firm. A biotechnology firm, with no current...
-
Smoke alarms with a UL label have been certified to last 10 years (Source: Underwriters Laboratories). Assume the lifetimes of smoke alarms with a UL label are normally distributed with mean 10.8...
-
Our company just purchased diamond rights for $1,000,000. It has an estimate of 2,000,000 carats. This year we extracted 500,000 carats. REQUIRED: ANSWERS these Questions (a) Determine the depletion...
-
As of February 1, 2009, Krispy Kreme Doughnuts had \(\$ 100,000\) of Notes Receivable due before January 31 , \(2010, \$ 1,268,000\) of Accounts Receivable, and \(\$ 249,000\) in its Allowance for...
-
Power may be defined as the influence over the beliefs, emotions, and behaviors of people. TRUE/FALSE.
-
Does scheduling according to shortest processing time tend to minimize average flowtime or average tardiness?
-
Check whether for any positve \(\tau\) the stochastic process \(\{V(t), t \geq 0\}\) defined by \[V(t)=B(t+\tau)-B(t)\] is weakly stationary.
-
An employee's degree of job satisfaction is proportional to the actual amount of rewards the employee is receiving. TRUE/FALSE.
-
4. (40 points) Size the following circuit using LE and determine the total delay and size of each gate when Coff-path =0, Coff-path=5, Coff-path 30 and Coff-path = 120. a. Use the non-iterative...
-
(a) With not more than 300 words, examine why Malaysia missed its 2020 targets to divert 40% of waste from landfills and increase recycling rates to 22%. (10 marks) b) Why arent Malaysian recycling?...
-
Write a method with the following header to display an integer in reverse order: public static void reverse(int number) For example, reverse(3456) displays 6543. Write a test program that prompts the...
-
Write a program that displays an AVL tree along with its balance factor for each node.
-
An n ? n matrix is called a positive Markov matrix if each element is positive and the sum of the elements in each column is 1. Write the following method to check whether a matrix is a Markov...
-
Suppose that the pdf of y has a C -component mixture form, f ( y ) = j = 1 c j f j ( y ) , where = ( 1 , , C ) , j > 0 , j = 1 c j = 1 . The j are unknown mixing proportions whereas the...
-
Let ( y 1 i , y 2 i ) , i = 1 , , N , have a bivariate normal distribution with mean ( 1 , 2 ) and covariance parameters ( 11 , 12 , 22 ) and correlation coefficient . Suppose that all N...
-
Consider calculation of the MLE in the logit regression model when the only regressor is the intercept. Then E [ y ] = 1 / ( 1 + e ) and the gradient of the scaled log-likelihood function g ( ) =...
Study smarter with the SolutionInn App