Write three classes to represent a payment. A payment class represents a payment by the amount of
Question:
Write three classes to represent a payment.
A payment class represents a payment by the amount of money (as a double) and the date of the payment.
A cash payment represents a payment by the amount and date.
A credit card payment represents a payment by the amount, date, and also the name and credit card number.
In each class, include:
instance data variables
getters and setters
a toString method
In the credit card payment class, include an equals method. Two payments are logically equivalent if they have the same amount, date, name, and credit card number.
Make sure to include a driver program!
When designing your classes, consider the following.
For all required methods, your class can either include the method directly or inherit it- whichever makes sense for that method!
Think about what the parent-child relationship should be between the classes.
Think about what information should be sent as parameters and what information can be hard-coded (using constants) into a class.
Move common code as high up in the hierarchy as possible.
Use super whenever possible.
Avoid repeated code.
Follow appropriate naming and style conventions.
Follow good principals of object-oriented design and inheritance.
Financial Reporting Financial Statement Analysis and Valuation a strategic perspective
ISBN: 978-1337614689
9th edition
Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw