Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Modify the code in the library.js file so it contains a class named Calculator. This class should have a constructor which defines properties for both
Modify the code in the library.js file so it contains a class named Calculator. This class should
have a constructor which defines properties for both input values.
The class should also have methods, for each of the math operations. If both values are valid
then each function should return the result of the calculation. If the results are not valid, it should throw an exception.
Modify the claculate.js file to create and use an object from the Calculator class. Then use the object to perform the calculations when each of the buttons are pressed.
Note that you should still validate the user entries to prevent an exception from being thrown.
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