CS504 Assignment 3 Solution Spring 2017

Question No .1 (8 Marks)

Design patterns are programming language independent strategies for solving the common object-oriented design problems. A design pattern isn’t a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Consider given scenarios:

1. ABC Meteorological Department is a scientific and a service department that provides daily updated weather data of different cities across country. It includes daily detailed temperature information. This information is accessed and used by different organizations like aviation and newspapers/websites .Similarly these facts and figures are used by different TV channels for regular weather forecast based on these facts. Every organization processes /sort data and present processed data in different formats. Which design pattern will be suitable that will notify updated data of meteorological department to all related departments (that have to use it for specified purposes).

2. A team of software engineers is working on a Project. Application will be supported on different platforms/operating systems. A GUI framework is required that will handle different application controls like buttons, text boxes and Edit Boxes. Programming multiple control types separately for different operating system is very difficult. We need a common configuration mechanism that will support individual instantiation for each control. Which design pattern will be suitable for mentioned scenario that will return specific/specialized controls? Name design pattern for each scenario and also explain reason.

Question No. 2  12 Marks

Give code according to description. It should be of standard format according to coding conventions/style guidelines discussed. Sr. No Description Standard Format 1. Declare a variable for storage of teacher salary 2. Declare A private variable of class Patient to store appointment time 3. Declare a variable that will store number of items 4. Declare/Name a function to calculate bill 5. Constant of float type to calculate Total Bill 6. Variable to check weather status of a student is pass or fail in a course.