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
In a planetary geartrain with a form factor of 8, the sun gear rotates clockwise at 5 rad⁄s and the ring gear rotates clockwise
lina2011 [118]

Answer:

D. N= 11. 22 rad/s (CW)

Explanation:

Given that

Form factor R = 8

Speed of sun gear = 5 rad/s (CW)

Speed of ring gear = 12 rad/s (CW)

Lets take speed of carrier gear is N

From Algebraic method ,the relationship between speed and form factor given as follows

\dfrac{N_{sun}-N}{N_{ring}-N}=-R

here negative sign means that ring and sun gear rotates in opposite direction

Lets take CW as positive and ACW as negative.

Now by putting the values

\dfrac{N_{sun}-N}{N_{ring}-N}=-R

\dfrac{5-N}{12-N}=-8

N= 11. 22 rad/s (CW)

So the speed of carrier gear is 11.22 rad/s clockwise.

8 0
3 years ago
What colour is best for radiative heat transfer? a. Black b. Brown c. Blue d. White
GarryVolchara [31]

Answer:

The correct answer is option 'a': Black

Explanation:

As we know that for an object which is black in color it absorbs all the electromagnetic radiation's that are incident on it. Thus if we need to transfer energy to an object by radiation the most suitable color for the process  is black.

In contrast to black color white color is an excellent reflector, reflecting all the incident radiation that may be incident on it hence is the least suitable material for radiative heat transfer.

8 0
3 years ago
What advanced safety features are now standard on 2023 Z?
Anettt [7]

The advanced safety features that are now standard on 2023 Z are:

  • Pedestrian Detection and Automatic Emergency Braking
  • Intelligent Forward Collision Warning (IFCW).
  • Blind Spot Alert.

<h3>What is 2023 Z?</h3>

The above is the short name or nickname for the All New 2023 Nissan Z coupe Sports car.

The care also features Advanced driver assist and safety technology which relieves the driver's everyday workload, allowing you to focus on what matters most.

Learn more about safety features in cars:
brainly.com/question/24078882
#SPJ1


3 0
2 years ago
(Gas Mileage) Drivers are concerned with the mileage their automobiles get. One driver has kept track of several trips by record
Effectus [21]

Answer:

import java.util.*;

public class Main {

   

   public static void main(String[] args) {

     

       double milesPerGallon = 0;

       int totalMiles = 0;

       int totalGallons = 0;

       double totalMPG = 0;

       

       Scanner input = new Scanner(System.in);

 

       while(true){

           System.out.print("Enter the miles driven: ");

           int miles = input.nextInt();

           if(miles <= 0)

               break;

           else{

               System.out.print("Enter the gallons used: ");

               int gallons = input.nextInt();

               totalMiles += miles;

               totalGallons += gallons;

               milesPerGallon = (double) miles/gallons;

               totalMPG = (double) totalMiles / totalGallons;

               System.out.printf("Miles per gallon for this trip is: %.1f\n", milesPerGallon);

               System.out.printf("Total miles per gallon is: %.1f\n", totalMPG);

           }

       }

   }  

}

Explanation:

Initialize the variables

Create a while loop that iterates until the specified condition is met inside the loop

Inside the loop, ask the user to enter the miles. If the miles is less than or equal to 0, stop the loop. Otherwise, for each trip do the following: Ask the user to enter the gallons. Add the miles and gallons to totalMiles and totalGallons respectively. Calculate the milesPerGallon (divide miles by gallons). Calculate the totalMPG (divide totalMiles by totalGallons). Print the miles per gallon and total miles per gallon.

6 0
3 years ago
Unlike expendable molds, permanent molds do not collapse, so the mold must be opened before appreciable cooling contraction occu
Pani-rosa [81]

Answer: True

Explanation:

Permanent molds do not collapse, unlike expendable molds so the mold must be opened before appreciable cooling contraction occurs in order to prevent cracks from developing in the casting.

The metal casting becomes solid inside the mold after it has been poured. But during the process of manufacture, before the would cools any further, they usually remove the metal cast in order to stop excess contractions of the solid metal casting in the mold. This is done to prevent prevent cracks from developing in the casting since permanent mold do not collapse.

8 0
3 years ago
Other questions:
  • The following laboratory tests are performed on aggregate samples:a. Specific gravity and absorptionb. Soundnessc. Sieve analysi
    13·1 answer
  • Refrigerant-134a enters a 28-cm-diameter pipe steadily at 200 kPa and 20°C with a velocity of 5 m/s. The refrigerant gains heat
    15·1 answer
  • What does it mean to wire solar cells in parallel vs. wiring them in series? I always get these switched around.​
    10·1 answer
  • A reversible process and an irreversible process both have the same________ between the same two states. a. Internal energy b. W
    6·1 answer
  • Who is/are the founder/founders of transistor? ​
    9·2 answers
  • Parallel circuits???
    9·1 answer
  • Why does teachers grade things that are not due yet​
    13·2 answers
  • thier only motto and goal is to work for society and not make any profits A.small business entreprenuership B.scalable start up
    6·2 answers
  • Implement a program that manages shapes. Implement a class named Shape with a method area() which returns the double value 0.0.
    8·1 answer
  • 120 litres of water is discharge from container in 25 seconds. Find the rate of discharge in cumecs.if the discharge took place
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!