Sie sind auf Seite 1von 4

National University of Science and Technology

Software Design And Architecture Assignment #01


Submitted to: Dr. Rafia Mumtaz Submitted by: Tayyba Fatima BESE 1B Reg#311

Deadline: 2nd March 2012 4pm Late submission will not be accepted

Q1.Categorize the following aspects of a design by the types of coupling theyexhibit. (a) Class CourseSection has public class variables called minClassSize andmaxClassSize. These are changed from time to time by the university administration. Many methods in classes Student and Registration access these variables. Conten Coupling as one class is modifying the content of other class. (b) A user interface class imports a large number of Java classes, includingthose that draw graphics, those that create UI controls and a number ofother utility classes Import or Inclusion Coupling as user interface imports a large number of java classes. (c) A system has a class called Address. This class has four public variables constituting different parts of an address. Several different classes, such as Person and Airport manipulate instances of this class, directly modifying the fields of addresses. Also, many methods declare one of their arguments to be an Address. Stamp Coupling as Person and Airport classes are having an object of Address class as its argument. Q2.For each of the following sets of classes, find an appropriate superclass and the polymorphic operations that should be included in this superclass. Explain the way these operations would behave in each subclass and identify some operations that might be present in only one of the subclasses. (a) Square, Circle, Rectangle SuperClass: Shapes Polymorphic Operations: 1.int Set-dimension(int x, int y) In square, condition imposed x=y In circle set any one of it equal to zero as only radius is required. In Rectangle, both length and width is required, nothing should be zero! 2.int get_area(int x,int y) In square, it multiple x or y with itself and return the result In Circle , it multiple non zero argument with itself and then with pie In Rectangle, it multiple x with y Specialized Operations for Subclasses: For Circle: Get_Circumfrence(int x) For Rectangle: Get_length_difference_at opposite_sides(int x,int y)

(b) Truck, Ambulance, Bus Super Class: Vehicles Polymorphic Operations: Passeneger_capacity(int num) For Truck,ambulance and bus: It will Return the number of passengers which can be adjusted inside it. Get_length(int x) In all three, it will return the length of the vehicle Specialized Operations for Subclasses: For Truck Int Carriage_Support(int num_tons) For Ambulance: Total_num_of_beds(int num) For Bus: Int Bus_route()

(c) Technician, AdministrativeAssistant, Manager Super Class: Employee_Category Polymorphic Operations: Personal_Info() It gives the information about each one of the employee. Job_services_duration() It returns the time period since the employee has joined company. Specialized Operations for Subclasses: For Technician: String Field_specialization () It returns the specialized type of technician For Manager: Int num_of_TeamMem()

Q3.Which of the following would not form good superclasssubclass pairs(generalizations), and why? (a) Money CanadianDollars is relation satisfied, as Canadian dollars is type of money, it is a money. (b) Bank Account Is relations isnt satisfied. Account is not an bank!!! (c) OrganizationUnit Division is relation satisfied (d) SavingAccount CheckingAccount Is relation doesnt satisfied as checking account is not saving aaccount. Account can be its superclass. (e) Account Account12876 Is relation satisfied. (f) People Customer Is relation Satisfied as customer belongs to People super class (g) Student GraduateStudent Graduate student belongs to student class, it is proper generalization. (h) Continent Country Country is not a continent, but a combination of countries is continent so generalization cant be apply. (i) Municipality Neighborhood Municipality is about self-governing of area, and neighborhood is not a municipality!

Das könnte Ihnen auch gefallen