Description

ASSIGNMENT # 1SOFTWARE ARCHITECTURE & DESIGN SUBMITTED TO: Ma’am Rafia Mumtaz SUBMITTED BY : Usman Ali Khan REG. # NUST-2010-BESE1B-272 Dated: 2/03/2012 Several different classes. (b) A user interface class imports a large number of Java classes. such as Person and Airport manipulate instances of this class.For each of the following sets of classes. Rectangle SUPERCLASS: Shape POLYMORPHIC OPERATIONS: Void Draw( ) Float area( ) Void GetParameters( ) Circle class have a function of int get_radius( ) function which will get the radius of the circle to be drawn. many methods declare one of their arguments to be an Address ANSWER:It should exhibit content coupling as four variables are declared as public data members. Many methods in classes Student and Registration access these variables. of classes can access them. Circle. . Q2. including those that draw graphics. directly modifying the fields of addresses. (a) Class CourseSection has public class variables called minClassSize and maxClassSize. These are changed from time to time by the university administration. (c) A system has a class called Address. (a) Square. ANSWER: It should exhibit content coupling because minClassSize & maxClassSize are declared as public and many different classes are accessing them and they can be modified very easily unless they are declared as private data members. Explain the way these operations would behave in each subclass and identify some operations that might be present in only one of the subclasses. of classes and utility tools are imported. find an appropriate superclass and the polymorphic operations that should be included in this superclass. (b) Truck. Bus SUPERCLASS: Vehicle POLYMORPHIC OPERATIONS: Void get_passengers( ) Void get_FuelConsumption( ) All the classes inherit the above funtions except ambulance which will use Void NoOfPatients( ) instead of Void Get_passengers. those that create UI controls and a number of other utility classes. ANSWER: It exhibit inclusion coupling as no.while Void GetParameter( ) will get the parameters of remaining shapes. Ambulance. This class has four public variables constituting different parts of an address.Q1. Also. Moreover no. It also exhibit Stamp coupling as Address is also used as an argument in methods.Categorize the following aspects of a design by the types of coupling they exhibit. (g) Student – Graduate Student: Yes they form a good pair because graduated student is a type of student and can inherit some common functions. it’s not a good idea to form a pair of these two as superclasssubclass as country is not inheriting anything from continent. Customers are actually people and operations of people class can also be present in the customer class. Moreover operations in bank can’t be used in account. Bank-account can’t be a good pair for superclass-subclass pair as account is not a type of bank. Administrative Assistant. (h) Continent – Country: No.Which of the following would not form good superclass–subclass pairs (generalizations). (c) Organization Unit – Division: yes. (e) Account – Account12876: No it’s not a good pair because account12876 is in fact an instance of the class and account12876 is not the type of the account but it is the name of the account. In fact Account class can be used as a superclass for both of them. Q3. (d) Saving Account – Checking Account: No it’s not a good idea to declare this pair as superclass-subclass pair because of the fact that both of them are types of accounts. they form well an example of generalization. (i) Municipality – Neighborhood: Yes these two form a good pair because there is a lot common between these two and neighborhood can’t inherit many things from municipality. (f) People – Customer: Yes they form a good pair. . Manager SUPERCLASS: Staff POLYMORPHIC OPERATIONS: Void set_duties( ) Void get_workingHours( ) Void get_PayPerHour( ) All the classe inherit above mentioned function while manager class have an extra function of Void Managing( ). (b) Bank – Account: No.(c) Technician. and why? (a) Money – Canadian Dollars: It will form a good pair as Canadian dollar is a type of money.
Copyright © 2024 DOKUMEN.SITE Inc.