Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code required in java Virtual Dice Throwing and Point-Circle-Cylinder Inheritance and Polymorphism a program exercising inheritance and polymorphism. The program has the purpose to get
Code required in java
Virtual Dice Throwing and Point-Circle-Cylinder Inheritance and Polymorphism a program exercising inheritance and polymorphism. The program has the purpose to get you to implement the Point, Circle and Cylinder classes as in the lecture notes in order to get to understand better, assimilate and exercise the inheritance features taught in the lectures. You should implement those three classes using inheritance, with Shape being an interface instead of an abstract class. Although you can simply copy the code from the notes, it would be certainly more beneficial to write the code yourselves by looking at the notes in order to realise how object-oriented features related to inheritance are exercised and understand / assimilate the relevant principles. Having implemented these classes, you should write a ShapeTest program (or whatever you call it) which gets input from the user to create a Point, Circle or Cylinder accordingly. The user should be able to create as many of these shapes and s/he wants. The menu should also allow the user to printout the created objects. Optionally, the user may be allowed to remove an existing shape from the list. The program should print the objects it keeps in a simple array (NOT ArrayList) using the Shape getName(), toString(), getArea() and getVolume() methods, i.e. treating these objects polymorphically, in a similar fashion to the polymorphic test program in the notes. The program should deal gracefully with incorrect number and type of arguments through checks and exceptions
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started