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
Say you have a random, unordered list containing 4096 four-digit numbers. Describe the most efficient way to: sort the list and
Debora [2.8K]

Answer:

Answer explained below

Explanation:

It is given that numbers are four-digit so maximum value of a number in this list could be 9999.

So we need to sort a list of integers, where each integer lies between [0,9999].

For these given constraints we can use counting sort which will run in linear time i.e. O(n).

--------------------------------------------------------------------------------

Psuedo Code:

countSort(int numList[]) {

int count[10000];

count[i] = 0; for all i;

for(int num in numList){

count[num]+= 1;

}

return count;

}

--------------------------------------------------------------------------------

Searching in this count array will be just O(1).

E.g. Lets say we want to search if 3 was present in the original list.

Case 1: it was present in the original list:

Then the count[3] would have been incremented by our sorting algorithm. so in case element exists then count value of that element will be greater than 0.

Case 2: it was not present:

In this case count[3] will remain at 0. so in case element does not exist then count of that element will be 0.

So to search for an element, say x, we just need to check if count[x]>0.

So search is O(1).

Run times:

Sorting: O(n)

Search: O(1)

6 0
3 years ago
Discuss three objectives of Tariff and elaborate on three characteristics of it
Margaret [11]

Answer:

Three objectives of a tariff are

1) To control trade between countries

2) To protect domestic industries

3) To provide a source of income

Three characteristics of a tariff are;

1) Adequate return

2) Attractive

3) Fairness

Explanation:

A tariff is an import or export tax placed on goods traded between countries, it serves to control the foreign trade between the two countries and to protect or develop local industry

A Tariff is an important source of income to countries

Three characteristics of a tariff are;

1) Adequate return

Proper return from the consumer should be factored in a tariff to account for the alternatives or normal expense pattern

2) Attractive

The tariff should be attractive to encourage consumption of electricity or complimentary goods

3) Fairness

Based on the consumption of related resources brought about by large scale utilization, large consumer tariff should be lower than those that consume less complementary resources.

5 0
3 years ago
HELP PLEASE!!!!!!!!!!!
MAXImum [283]
C is your answers!!!!!$3&2)//
7 0
3 years ago
Read 2 more answers
Water vapor at 1.0 MPa, 300°C enters a turbine operating at steady state and expands to 15 kPa. The work developed by the turbin
Andre45 [30]

Answer:

a) isentropic efficiency = 84.905%

b) rate of entropy generation = .341 kj/(kg.k)

Please kindly see explaination and attachment.

Explanation:

a) isentropic efficiency = 84.905%

b) rate of entropy generation = .341 kj/(kg.k)

The Isentropic efficiency of a turbine is a comparison of the actual power output with the Isentropic case.

Entropy can be defined as the thermodynamic quantity representing the unavailability of a system's thermal energy for conversion into mechanical work, often interpreted as the degree of disorder or randomness in the system.

Please refer to attachment for step by step solution of the question.

5 0
3 years ago
Question 7.1: Two possible overhead valve combustion chambers are being considered – the first has two valves; the second has fo
AleksandrR [38]

Answer:

1) The adoption of the second design we can see that the total valve perimeter is increased by 60.8%

2) Increase in flow are : 29%

3) Additional benefits in using 4 valves per cylinder:

a)For the purpose of controlling the combustion process, the inlet valves will give more flexibility

b) There is a larger valve throat areas for the flow of gas

Explanation:

1) Perimeter of the first possible overhead valve combustion chamber with two valves:

P₂ = πd = π × 23 = 72.26mm

Perimeter of the second possible overhead valve combustion chamber with four valves:

P₄ = π2d = π × 18.5 × 2 = 116.24 mm

If second design is adopted, percentage increase = ((P₄ - P₂)/P₂)×100

     = ((116.24 - 72.26)/72.26)×100 = 0.6086 ×100 = 60.86%

Therefore, the total valve perimeter is shown to have increased by 60.8%

2) Formula for flow Area (A) = P × L = πkd²

Area of the first possible overhead valve combustion chamber with two valves: A₂ = πkd² = πk(23)² = 1662k mm²

Area of the first possible overhead valve combustion chamber with four valves: A₄ = πkd² = 2πk(18.5)² = 2150k mm²

The percentage increase in flow area: ((A₄ - A₂)/A₄)×100 = ((2150 - 1662)/2150)×100 = 29%

3) The additional benefits of using are:

a) For the purpose of controlling the combustion process, the inlet valves will give more flexibility

b) There is a larger valve throat areas for the flow of gas

           

7 0
3 years ago
Other questions:
  • Why should engineers avoid obvious patterns?
    13·2 answers
  • 6.Identification of Material ParametersThe principal in-plane stresses and associated strains in a plate of material areσ1= 50 k
    5·1 answer
  • For problems 1 and 2, six luminaires, similar to Style E used in the Commercial Building, are to be installed in a room that is
    13·1 answer
  • Write analgorithm and a C code to calculate the sum and average value of an array12elements.For example: Array_Temperaure=[10, 1
    6·1 answer
  • A 36 ft simply supported beam is loaded with concentrated loads 16 ft inwards from each support. On the left side, the dead load
    7·1 answer
  • A flashed steam geothermal power plant is located where underground hot water is available as saturated liquid at 700 kPa. The w
    14·1 answer
  • 25 points and brainliest is it A, B, C, D
    5·2 answers
  • To understand the concept of moment of a force and how to calculate it using a scalar formulation.
    9·1 answer
  • Please help me on this it’s due now
    14·1 answer
  • Which one of the following best defines hardness: (a) energy absorbed by a material when an object strikes its surface, (b) resi
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!