Task Description: Implement a Simple Calculator Functionality
You need to implement a simple calculator that supports basic arithmetic operations: addition, subtraction, multiplication, and division. The calculator should be capable of handling both integer and floating-point numbers.
Requirements:
Functionality:
Create a class named Calculator within the /app/ directory.
The class should have the following methods:
add(a: float, b: float) -> float: Returns the sum of a and b.
subtract(a: float, b: float) -> float: Returns the difference of a and b (i.e., a - b).
multiply(a: float, b: float) -> float: Returns the product of a and b.
divide(a: float, b: float) -> float: Returns the quotient of a divided by b. If b is zero, it should raise a ValueError with the message "Cannot divide by zero."
Input Handling:
Ensure that the methods can accept both integer and floating-point inputs and return results as floats.
Error Handling:
For division, include error handling to properly manage division by zero.
Testing:
Ensure that your implementation makes the inline tests within the provided test code pass, which cover various cases, including positive, negative, and zero values.
Deliverables:
The complete implementation of the Calculator class with the specified methods in /app/.
Proper error handling as specified.
Ensure that your code is clean and well-documented for maintainability.