Lab 8
Create an abstract base class called Shape and move the static variable scaleFactor and the three instance variables id, xLoc and yLoc from RightTriangle to Shape along with the get and set methods for those variables. Implement a Shape constructor and update the RightTriangle constructor to call the Shape constructor for the variables moved to Shape. Then add three abstract methods to Shape called getArea(), getPerimeter() and scaleShape().
Define three classes that extend Shape called Circle, Rectangle and RightTriangle. Much of RightTriangle can be copied from Lab 6, and much of Circle and Rectangle from the slides and in class work. For each class define the needed instance variables and an appropriate constructor to initializes those instance variables and call the Shape constructor for the instance variables defined on Shape, and then override the three abstract methods defined on Shape.
Write an application which shows the user the following menu and implements all options. The program should continue to run and process requests until the user chooses to exit. The program should double-check that the user really wants to exit. You may use a limit of 10 possible shapes to simplify implementation. All input must be validated and appropriate feedback given for invalid input.
You must use an array of Shapes to hold all objects. You cannot have an array of Circle, Rectangle or RightTriangle objects. Additionally, only option 1 can use the Circle type, only option 2 can use the Rectangle type and only option 3 can use the RightTriangle type. Options 4-7 may only use the Shape type.
1 – Add a new circle
2 – Add a new rectangle
3 – Add a new right triangle
4 – Delete a shape
5 – Delete all shapes
6 – Display all shapes
7 – Move a shape
8– Enter a scale factor
9– Scale all shapes
10– Exit program
For a custom paper on the above topic, place your order now!
What We Offer:
• On-time delivery guarantee
• PhD-level writers
• Automatic plagiarism check
• 100% money-back guarantee
• 100% Privacy and Confidentiality
• High Quality custom-written papers
You May Also Like This:
- Domino Game.
- Historical forces of the nineteenth century which shape Australia today.
- You have been called to the home of a 87 year old woman, Chantelle, who has experienced an episode of syncope and chest pain.
- Refugees& Forced Migration
- Protein toxins that may interfere with host cell function or damage host cell membranes and are usually secreted by living bacteria are called
- Visual analysis of Samson and Delilah
- Space debris
- program by C#
- Real Estate Data
- cusomizstions
- The Implication of Full Metal Jacket for Iliac Vein Stenting
- menu of options
- Analysis data (worm tracker )
- Molecular Taxonomy
- Variables, Measurement, and SPSS
- programming project that involves a clock:
- Service Evaluation Proposal
- Exploratory Data Analysis
- Coding
- art