The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Please open the worksheet for problem.  It involves psudoecode.
Â
Design a class called SimpleCalculator using psudoecode that contains public methods namedadd(),subtract(). Each of the methods accepts two numeric arguments and returns a number thatrepresents the result of the appropriate arithmeTc operaTon. Design a sub-class of SimpleCalculatorcalled Calculator using psudoecode that contains public methods named mulTply(), and divide() and thatdeFnes private Felds called num1 and num2. Each of the methods accepts two numeric arguments andreturns a number that represents the result of the appropriate arithmeTc operaTon. Design a two-argconstructor Calculator() that sets the two values num1 and num2. Design a main() method that promptsthe user for two numbers and reads them in. ±hen creates an instance of the Calculator class se²ng theinput values via the Calculator constructor. ±he main() method then tries each of the four arithmeTcmethods. Assume that an DivideByZero is created and thrown if the user a³empts to divide by 0. Displayan appropriate message when an excepTon is caught. If no excepTon, display the results from eacharithmeTc method call.Changes:±he four methods that the original instrucTons ask you to create. Make sure they are staTc methods.Add four new methods to the Calculator class - they will overload your current methods, they will also beinstance methods.±he four methods to add: mulTply, divide, add, and subtract. ±hey will not take any parameters and willreturn the result of applying the relaTve operaTon to the a³ribute values num1 and num2. ±hese fourmethods must call upon their overloaded counterparts to process the informaTon. ±his will require theuse of the keyword 'super' for add and subtract, and simply calling the staTc versions of mulTply ordivide sending them the appropriate data. Your main method will test all eight methods that werecreated (this requires the creaTon of a Calculator object).
Attachments: