Question: Q 1 . Create a class Compute with two float variables and four methods such as add ( ) , subtract ( ) , multiply

Q1. Create a class Compute with two float variables and four methods such as add(), subtract(), multiply() and divide(). Define these methods as follows. (10 M)
a. Define add() method that does not return anything;
b. subtract() method that return the result;
c. multiply() and divide() receives the parameters and then it calculates the result and print it. The multiply() and divide() does not return anything.
d. Finally, create a Result class that creates the object of the class Compute and call the respective methods.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!