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
A strain gage is mounted at an angle of 30° with respect to the longitudinal axis of the cylindrical pressure. The pressure vess
GuDViN [60]

Answer:

1790 μrad.

Explanation:

Young's modulus, E is given as 10000 ksi,

μ is given as 0.33,

Inside diameter, d = 54 in,

Thickness, t = 1 in,

Pressure, p = 794 psi = 0.794 ksi

To determine shear strain, longitudinal strain and circumferential strain will be evaluated,

Longitudinal strain, eL = (pd/4tE)(1 - 2μ)

eL = (0.794 x 54)(1 - 0.66)/(4 x 1 x 10000)

eL = 3.64 x 10-⁴ radians

Circumferential strain , eH = (pd/4tE)(2-μ)

eH = (0.794 x 54)(2 - 0.33)/(4 x 1 x 10000)

eH = 1.79 x 10-³ radians

The maximum shear strain is 1790 μrad.

4 0
3 years ago
A gasoline engine has a piston/cylinder with 0.1 kg air at 4 MPa, 1527◦C after combustion, and this is expanded in a polytropic
Roman55 [17]

Answer:

The expansion work is 71.24 kJ and heat transfer is -16.89 kJ

Explanation:

From ideal gas law,

Initial volume (V1) = nRT/P

n is the number of moles of air in the cylinder = mass/MW = 0.1/29 = 0.00345 kgmol

R is gas constant = 8314.34 J/kgmol.K

T is initial temperature = 1527 °C = 1527+273 = 1800 K

P is initial pressure = 4 MPa = 4×10^6 Pa

V1 = 0.00345×8314.34×1800/(4×10^6) = 0.013 m^3

V2 = 10×V1 = 10×0.013 = 0.13 m^3

The process is a polytropic expansion process

polytropic exponent (n) = 1.5

P2 = P1(V1/V2)^n = 4×10^6(0.013/0.13)^1.5 = 1.26×10^5 Pa

Expansion work = (P1V1 - P2V2) ÷ (n - 1) = (4×10^6 × 0.013 - 1.26×10^5 × 0.13) ÷ (1.5 - 1) = 35620 ÷ 0.5 = 71240 J = 71240/1000 = 71.24 kJ

Heat transfer = change in internal energy + expansion work

change in internal energy (∆U) = Cv(T2 - T1)

T2 = PV/nR = 1.26×10^5 × 0.13/0.00345×8314.34 = 571 K

Cv = 20.785 kJ/kgmol.K

∆U = 20.785(571 - 1800) = -25544.765 kJ/kgmol × 0.00345 kgmol = -88.13 kJ

Heat transfer = -88.13 + 71.24 = -16.89 kJ

5 0
3 years ago
un contenedor de 0.01m∧3 se llena con 2kg de nitrogeno a una presion de 15mpa ¿cual es la temperatura del nitrogeno?resolver uti
777dan777 [17]
Ecfñnokg pinogdf gabn Etta r
7 0
3 years ago
A sports car has a drag coefficient of 0.29 and a frontal area of 20 ft2, and is travelling at a speed of 120 mi/hour. How much
Andrej [43]

Answer:

Power required to overcome aerodynamic drag is 50.971 KW

Explanation:

For explanation see the picture attached

4 0
3 years ago
(True/False) Unix is written in the C language. *<br> True<br> O False
Katarina [22]

Answer:

false

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • Jen is developing the positioning statement for a new line of sunglasses. In a meeting, the marketing team tells Jen that she ha
    9·1 answer
  • What is the temperature dependency of the electrical conductivity for metals and semiconductors??
    6·1 answer
  • The rate at which velocity changes is called?
    5·2 answers
  • WHAT IS THE MOST POWERFUL PART IN A CAR
    13·2 answers
  • A car accelerates uniformly from rest to 60 km/h in 30 s. What is its displacement during this time?
    7·1 answer
  • Why would Chris most likely conclude that he should seek help? A. He feels in control of his emotions even though people annoy h
    15·2 answers
  • Sam constructs a circuit, connects a lead acid battery of 2 V to a lamp of resistance 3 Ω and places an ammeter across it. What
    8·2 answers
  • A fan draws air from the atmosphere through a 0.30-mdiameter round duct that has a smoothly rounded entrance. A differential man
    14·1 answer
  • Does anyone know obamas last name???? please help its for a friend I swear!!!111!!11!
    8·1 answer
  • Which statement is true about the future of space travel?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!