Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SE450 Assignment 01 Objective: Understanding and practicing object-oriented programming concepts and principles. Understanding and practicing UML class diagrams Exercise 1. True or False Statements with

SE450 Assignment 01 Objective: Understanding and practicing object-oriented programming concepts and principles. Understanding and practicing UML class diagrams Exercise 1. True or False Statements with justification if false 1. The implementation of inheritance always involves writing a few less lines. 2. The following class declaration is incorrect: public final class Class extends OtherClass {...} 3. Inheritance is only useful if specialization is used. In fact, specializing we inherit in the subclass (or subclasses) members of the superclass that we must not rewrite. Instead with the generalization we create an extra class, and then we write more code. 4. The super keyword allows you to call superclass methods and constructors. The keyword this allows you to call methods and constructors of the same class. 5. Multiple inheritance does not exist in Java because it does not exist in reality. 6. A subclass is bigger than a superclass (in the sense that it usually adds new features and functionality compared to the superclass). 7. Suppose we develop an application to manage a soccer tournament. There is inheritance derived from specialization between the Team and Player classes. 8. Suppose we develop an application to manage a soccer tournament. There can be inheritance derived from generalization between the Team and Player classes. 9. In general, if we had two classes, Father and Son, there would be no inheritance between these two classes. 10. An interface can extend an abstract class and an interface. Exercise 2 Object Oriented Programming 2.1 public class OOPExercises { public static void main(String[] args) { A objA = new A(); System.out.println("in main(): "); System.out.println("objA.a = "+objA.a); objA.a = 222; } } Point out the error(s) and how they can be fixed. public class A { private int a = 100; public void setA( int value) { a = value; } public int getA() { return a; } } //class A 2.2 public class OOPExercises { public static void main(String[] args) { System.out.println("in main(): "); System.out.println("objA.a = "+getA() ); setA(123); } } Point out the error(s) and how they can be fixed. public class A { private int a = 100; public void setA( int value) { a = value; } public int getA() { return a; } } //class A 2.3 public class OOPExercises { public static void main(String[] args) { A objA = new A( ); double result; result = objA.getA( ); System.out.println("objA.a = "+ result); } } Point out the error(s) and how they can be fixed. public class A { private int a = 100; public void setA( int value) { a = value; } public int getA() { return a; } } //class A 2.4 public class B extends A { private int a = 222; public static void main(String[] args) { System.out.println("in main(): "); System.out.println("a = "+a ); a = 123; } } Point out the error(s) and how they can be fixed. public class A { private int a = 100; public void setA( int value) { a = value; } public int getA() { return a; } } //class A 2.5 A student wishes to create a class for a 3D vector and chooses to derive from the Vector2D class (i.e. public void Vector3D extends Vector2D). The argument is that a 3D vector is a 2D vector with some stuff added. Explain the conceptual misunderstanding here. Exercise 3: UML Design Draw a detailed class diagram (contains associations, multiplicity, attributes, methods. if necessary) based on the description below: The university keeps track of each student's name, student number, social security number, current address and phone, permanent address and phone, birthdate, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program (B.A., B.S., ..., Ph.D.). Some user applications need to refer to the city, state, and zip of the student's permanent address, and to the students' last name. Each department is described by a name, department code, office number, office phone and college. Each course has a course name, description, code number, number of semester hours, level, and offering department. Each section has an instructor, semester, year, course, and section number. A grade report has a student, section, and grade. An administrator can update the courses to be taught by instructors, and enter the list of students taking a course. An instructor can enter and update the grades of the course(s) taught by this instructor. A student can request a grade report from the information system. Exercise 4: UML Design Draw a detailed class diagram (contains associations, multiplicity, attributes, methods. etc. if necessary) based on the description below. A system provides the basic services to manage bank accounts at a bank called OOBank. OOBank has many branches, each of which has an address and branch number. A client opens accounts at a branch. Each account is uniquely identified by an account number; it has a balance and a credit or overdraft limit. There are many types of accounts, including: A mortgage account (which has a collateralproperty), a checking account, and a credit card account (which has an expiry date and can have secondary cards attached to it). It is possible to have a joint account (e.g. for a husband and wife). Each type of account has a particular interest rate, a monthly fee and a specific set of privileges (e.g. ability to write cheques, insurance for purchases etc. Each customer is assigned a particular employee as his or her personal banker Submission: All the text and diagrams must be clearly visible. The entire assignment must be in a single PDF file. The PDF file name must be in the format LASTNAME-FIRSTNAME.pdf. For example, Kessentini-Wael.pdf. Submit your PDF file on D2LAssignment1 by 31/01/2023, 11:59 PM (CT) (D2L assignment 1)

Attachments:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Students also viewed these Programming questions

Question

Financial Accounting 8th edition chapter 2, 88p n 89p

Answered: 1 week ago