Hey,
I dont know where to start with this problem so I have a super class(Transaction) that has a constructor and I have 2 sub classes (rental and return )they both have the same constructor as the super but they have a toString method that is almost the same but not really . The rental has the id num ,format of the disc and the date and then the fee. while in the rent I have the id, format , fee. How can I write those method so I dont have duplicate codes and it easy to change and understand? I also want to get the total fee after the toString method at the end? can some one pleas help I would really be thankful !
JessJames
0
Newbie Poster
Recommended Answers
Jump to PostOk so in that problem they want you to use something called method overriding. What this means is as follows:
If a superclass (Transaction) has a method purchase(), then by default its subclasses (Rental, Return) will also have that same method. If I say:
Rental rent …
Jump to PostDelete this post please -- it resulted from a browser glitch.
All 5 Replies
kvass
70
Junior Poster
kvass
70
Junior Poster
kvass
70
Junior Poster
JessJames
0
Newbie Poster
kvass
70
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.