Question: Objectives: Implement basic class concepts in Java Implement inheritance with super and sub-classes Implement basic polymorphism concepts Problem: The TARDIS has been infected by a



Objectives: Implement basic class concepts in Java Implement inheritance with super and sub-classes Implement basic polymorphism concepts Problem: The TARDIS has been infected by a virus which means it is up to Doctor Who to manually enter calculations into the TARDIS interface. The calculations necessary to make the TARDIS work properly involve real, imaginary and complex numbers. The Doctor has asked you to create a program that will evaluate numerical expressions so that he can quickly enter the information into the TARDIS. Details: Classes o Number class - Number.java Attributes Real number (double) Methods Default constructor Overloaded constructor - pass in value for number Accessor Mutator toString equals o Complex number class - Complex.java Extends number class (-5 points if not) Attributes: Imaginary number (double) Methods Default constructor Overloaded Constructor - pass in real and imaginary numbers o call super constructor Accessor Mutator toString equals Read in the entire expression as a string and parse it into the proper objects Store each part of the in the correct attribute of the object Use the toString function to display the number when necessary Both the real and imaginary parts may be floating point values Validate that each expression contains no invalid characters The only valid letter in a complex number is i (lower case) O Check that each expression contains a valid operator Each number in the expression must be stored in the appropriate object Real numbers are not to be stored in a complex object If a line contains invalid data, ignore the line Numbers may be represented in 3 ways o Complex (real + imaginary) .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
