Question

In: Accounting

Design You will need to have at least four classes: a parent class, a child class,...

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?

Solutions

Expert Solution


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.


Related Solutions

Pick a pair of concrete classes in the JDK in a parent-child relationship and discuss a...
Pick a pair of concrete classes in the JDK in a parent-child relationship and discuss a few polymorphic and/or overloaded methods. Do not use Object as the parent class - it is too trivial to address the issues to be addressed here, and in any case, Object is the final parent of all classes in Java.
C++ Code Required to Show The constructor of parent class executes before child class
C++ Code Required to Show The constructor of parent class executes before child class
Specifications: This project will have two data classes and a tester class. Design: Create a solution...
Specifications: This project will have two data classes and a tester class. Design: Create a solution for this programming task. You will need to have the following parts: Text file to store data between runs. Two classes that implement the given interfaces. You may add methods beyond those in the interfaces A tester class that tests all of the methods of the data classes. Here are the interfaces for your data classes: package project1; import java.util.ArrayList; public interface Person {...
Specifications: This project will have two data classes and a tester class. Design: Create a solution...
Specifications: This project will have two data classes and a tester class. Design: Create a solution for this programming task. You will need to have the following parts: Text file to store data between runs. Two classes that implement the given interfaces. You may add methods beyond those in the interfaces A tester class that tests all of the methods of the data classes. Here are the interfaces for your data classes: package project1; import java.util.ArrayList; public interface Person {...
How could you describe this a sensitive child to a parent that feels their child is...
How could you describe this a sensitive child to a parent that feels their child is just shy (a parent that overlooks their child's sensitive behavior)? Without telling the parent they are wrong about their child's behavior?
C++ Code (I just need the dieselLocomotive Class) Vehicle Class The vehicle class is the parent...
C++ Code (I just need the dieselLocomotive Class) Vehicle Class The vehicle class is the parent class of the derived class: dieselLocomotive. Their inheritance will be public inheritance so reflect that appropriately in their .h files. The description of the vehicle class is given in the simple UML diagram below: vehicle -map: char** -name: string -size:int -------------------------- +vehicle() +getSize():int +setName(s:string):void +getName():string +getMap():char** +setMap(s: string):void +getMapAt(x:int, y:int):char +~vehicle() +operator--():void +determineRouteStatistics()=0:void The class variables are as follows: map: A 2D array of...
You are the parent of a child who is enrolled in an elementary school. You are...
You are the parent of a child who is enrolled in an elementary school. You are discussing the controversial topic of vaccination with another parent, who argues against it. How do you respond? Support all your assertions with evidence.
Here I'm using "person" as an abstract superclass or parent class, and "Student" as a derived/child...
Here I'm using "person" as an abstract superclass or parent class, and "Student" as a derived/child class. // File name: Person.h // Person is the base, or parent for chapter11 #pragma once #include <iostream> #include <string> using namespace std; class Person { private:    string fName;    string lName;    int areaCode;    int phone; public:    Person();    Person(string, string);    void setFirst(string);    void setLast(string);    void setPhoneNumber(int, int);    string getFirstlast();    string getLastFirst();    string getPhoneNumber();...
1.  Four different classes of bonds and its characteristics. Which class of bonds tends to have the...
1.  Four different classes of bonds and its characteristics. Which class of bonds tends to have the least amount of risk and whyß 2. What are 5 financial institutions that historically participate in the bond market? what are the goals for each institution? 3. regarding the term bond yield how does an investor really a return on a bond investment?
Create two child classes, UnderGraduateStudent and GraduateStudent that will extend from the Student class. Override the...
Create two child classes, UnderGraduateStudent and GraduateStudent that will extend from the Student class. Override the char getLetterGrade() method in each of the child classes. Use Student.java class defined below: (complete and compile) class Student {    private int id;    private int midtermExam;    private int finalExam;    public double calcAvg() {       double avg;       avg = (midtermExam + finalExam) / 2.0;       return avg;    }    public char getLetterGrade() {       char letterGrade = ‘ ‘;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT