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
mafiozo [28]
3 years ago
8

Implement a program that manages shapes. Implement a class named Shape with a method area() which returns the double value 0.0.

Implement three derived classes named Rectangle, Square, and Circle. Declare necessary properties in each including getter and setter function and a constructor that sets the values of these properties. Override the area() function in each by calculating the area using the defined properties in that class.Using Java to write a program that repeatedly shows the user a menu to create one of the three main shapes or to print the shapes created so far. If the user selects to create a new shape, the program prompts the user to enter the values for the size of the selected shape. The shape is then stored in an array. If the user selects to print the current shapes, print the name and the total area of each shape to the console.Hint: You may limit the size of the array to 10.
Engineering
1 answer:
djverab [1.8K]3 years ago
3 0

Answer:

Explanation:

The following code was written in Java. It creates classes for each one of the shapes requested and includes all of their variables and the area method, as well as a toString method. Then in the main method, the menu is created which allows the user to enter the shape that they want and if they decide to exit it will print out every shape within the shapes array. Due to technical reasons I have added the code as a txt file below and in the picture you can see the output.

Download txt
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> txt </span>
19e97f0877c0f4554bca1f4a163eadac.jpg
You might be interested in
Calculate the angle of banking on a bend of 100m radius so that vehicles can travel round the bend at 50km/hr without side thrus
saw5 [17]

Answer:

11.125°

Explanation:

Given:

Radius of bend, R = 100 m

Speed around the bend = 50 Km/hr = \frac{5}{18}\times50 = 13.89 m/s

Now,

We have the relation

\tan\theta=\frac{v^2}{gR}

where,

θ = angle of banking

g is the acceleration due to gravity

on substituting the respective values, we get

\tan\theta=\frac{13.89^2}{9.81\times100}

or

\tan\theta=0.1966

or

θ = 11.125°

3 0
3 years ago
Write a simple calculator program. Your program should ask for three things two whole numbers and an operator in the form of an
vekshin1

Answer:

The solution code is written in Java.

  1.        Scanner input = new Scanner(System.in);
  2.        System.out.print("Enter operator: ");
  3.        String operator = input.nextLine();
  4.        System.out.print("Enter first integer: ");
  5.        int num1 = input.nextInt();
  6.        System.out.print("Enter second integer: ");
  7.        int num2 = input.nextInt();
  8.        int result = 0;
  9.        switch(operator){
  10.            case "+":
  11.               result = num1 + num2;
  12.               break;
  13.            case "-":
  14.                result = num1 - num2;
  15.                break;
  16.            case "*":
  17.                result = num1 * num2;
  18.                break;
  19.            case "/":
  20.                result = num1 / num2;
  21.                break;
  22.            default:
  23.                System.out.println("Invalid operator");
  24.        }
  25.        System.out.println(result);

Explanation:

To ask for the user input for two whole numbers and an operator, we can use Java Scanner class object. Since the input operator is a string, we can use nextLine() method to get the operator string (Line 3). We use nextInt() method to get whole number input (Line 5 & 7).

Next we use the switch keyword and pass the operator into the switch structure to determine which case statement should be executed. For example,  if the input operator is "*" the statement  "<em>result = num1 * num2;</em> " will run and multiply <em>num1</em> with <em>num2. </em>

3 0
4 years ago
Can anyone help me ?
MrRa [10]
That’s too hard for me lol oof
3 0
3 years ago
The pressure distribution over a section of a two-dimensional wing at 4 degrees of incidence may be approximated as follows: Upp
Aliun [14]

Answer:

The lift coefficient is 0.3192 while that of the moment about the leading edge is-0.1306.

Explanation:

The Upper Surface Cp is given as

Cp_u=-0.8 *0.6 +0.1 \int\limits^1_{0.6} \, dx =-0.8*0.6+0.4*0.1

The Lower Surface Cp is given as

Cp_l=-0.4 *0.6 +0.1 \int\limits^1_{0.6} \, dx =-0.4*0.6+0.4*0.1

The difference of the Cp over the airfoil is given as

\Delta Cp=Cp_l-Cp_u\\\Delta Cp=-0.4*0.6+0.4*0.1-(-0.8*0.6-0.4*0.1)\\\Delta Cp=-0.4*0.6+0.4*0.1+0.8*0.6+0.4*0.1\\\Delta Cp=0.4*0.6+0.4*0.2\\\Delta Cp=0.32

Now the Lift Coefficient is given as

C_L=\Delta C_p cos(\alpha_i)\\C_L=0.32\times cos(4*\frac{\pi}{180})\\C_L=0.3192

Now the coefficient of moment about the leading edge is given as

C_M=-0.3*0.4*0.6-(0.6+\dfrac{0.4}{3})*0.2*0.4\\C_M=-0.1306

So the lift coefficient is 0.3192 while that of the moment about the leading edge is-0.1306.

5 0
3 years ago
We have a credit charge that is trying to process but we do not remember signing up and email login is not working? Is there a w
Dmitry_Shevchenko [17]

Answer:

<u>Yes</u>

Explanation:

In such a case, one way to check the <em>credit charge</em> is to <u>contact your bank, </u>doing so would allow the bank to check your account properly to determine where the transaction was originated from.

Another way you could check is to contact the online merchant where such a transaction was initiated.

6 0
3 years ago
Other questions:
  • How does internet work
    6·1 answer
  • The small washer is sliding down the cord OA. When it is at the midpoint, its speed is 28 m/s and its acceleration is 7 m/s 2 .
    13·1 answer
  • Pineapple contains about 20 wt% solid and the balance water. To make pineapple jam, crush
    11·1 answer
  • Four of the minterms of the completely specified function f(a, b, c, d) are m0, m1, m4, and m5.
    6·1 answer
  • Suppose that the voltage is reduced by 10 percent (to 90 VV). By what percentage is the power reduced? Assume that the resistanc
    10·1 answer
  • Please help me in this assignment.
    13·1 answer
  • An electric winch operates on 140 volts​ [V] and draws 6 amperes​ [A] of current. The winch has an efficiency of 64​%. The winch
    6·1 answer
  • A cylindrical part of diameter d is loaded by an axial force P. This causes a stress of P/A, where A = πd2/4. If the load is kno
    9·1 answer
  • A right triangle has a base of 12 inches and a height of 30 inches, what is the centroid of the triangle?​
    5·1 answer
  • Situation: Peter is designing a new hybrid car that functions on solar power. He is currently working on sketches of his design
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!