In: Accounting
Design You will need to have at least four classes: a parent class, a child class, a component class, and an unrelated class. The component object can be included as a field in any of the other three classes. Think about what each of the classes will represent. What added or modified methods will the child class have? What added fields will the child class have? Where does the component belong? How will the unrelated class interact with the others?
An example (do not use): - A Saxophone class that extends Musical_Instrument and has a Reed component. A Musician class that has a level of expertise in sight reading and a level of experience playing types of instruments. The Musician instance can play a Saxophone object and, depending on the attributes of the musician and the reed, can output a range of reactions from standing ovation to cringing and covering the ears.
Your classes should be declared in header file(s) (with RMEs and other comments) and defined in corresponding .cpp file(s).
To make sure your classes are working the way you designed, include a testing.cpp file that has a main function and tests all of your classes thoroughly.
Use your classes to have a fully-functioning program in main.cpp. The program should be interactive. The more effort you put in, the more you will impress the graders and get a good grade.
The project is out of 75 points. Design and Style 4 pts Are there at least four files and does each file have the correct code? 5 pts Are there sufficient comments and/or writings to explain what each method accomplishes and what each field represents? 5 pts Do the files follow the style guidelines from class? Are they readable? Do the names make sense? 6 pts Is there evidence of a well-thought-out design? Does each method have a clear purpose? Is this the best way to implement the class given the functionality goals? Implementation 5 pts Does the code compile and run? 20 pts Are there four classes: a parent class, a child class, a component class, and an unrelated class? 5 pts Does the child add fields and add/override methods when appropriate? 5 pts Does the component class make sense in the context of the program? Testing 5 pts Is every method tested (directly or indirectly)? 5 pts Does testing cover all possible cases? Program 10 pts Is the program fully functional? Does the functionality make sense to use with the classes? Is it interactive?
I have had recently two telephone interviews where I've been asked
about the differences between an Interface and an Abstract class. I
have explained every aspect of them I could think of, but it seems
they are waiting for me to mention something specific, and I don't
know what it is.
From my experience I think the following is true. If I am missing a
major point please let me know.
Interface:
Every single Method declared in an Interface will have to be
implemented in the subclass. Only Events, Delegates, Properties
(C#) and Methods can exist in a Interface. A class can implement
multiple Interfaces.
Abstract Class:
Only Abstract methods have to be implemented by the subclass. An
Abstract class can have normal methods with implementations.
Abstract class can also have class variables beside Events,
Delegates, Properties and Methods. A class can only implement one
abstract class only due non-existence of Multi-inheritance in
C#.
1. After all that, the interviewer came up with the question "What
if you had an Abstract class with only abstract methods? How would
that be different from an interface?" I didn't know the answer but
I think it's the inheritance as mentioned above right?
2. An another interviewer asked me what if you had a Public
variable inside the interface, how would that be different than in
Abstract Class? I insisted you can't have a public variable inside
an interface. I didn't know what he wanted to hear but he wasn't
satisfied either.