Thursday, November 28, 2019

CS504 Assignment 2 solution 2019










Scenario

These days, online shopping is very popular. Different online shopping sites offer variety of products to its customers. A customer can visit the website and purchase the desired items. Store management expands its product line time to time by adding new items. A product item in the system may go through any of five states during its life cycle. 

Store management adds new items in the system which becomes available for purchase to the customers. They can also remove or disable any item which becomes unavailable to the customers. Customers can select an item to their cart and they can also remove it from the cart to be available for purchase again. Item is purchased after confirmation of the order from the customer and it will be queued for shipment. A product item might become unavailable if it runs out of stock after a purchase. A queued item can also be cancelled by the customer before it is dispatched, which will become available for purchase again. Purchased item will be dispatched to the customer after confirming the status of the product item.




Question No. 1:                                                                                                                                   (10)
Carefully read the above mentioned scenario and identify the five possible states of product item life cycle. Also draw the State Transition Diagram for the mentioned scenario with proper labelling of the transitions.
Ans:
click on file to download the answer file.


============================================================

Question No. 2:                                                                                                                                   (10)
 Suppose you are hired as a software engineer in an XYZ organization for maintaining design of an existing educational institute system. For this purpose, you will need to apply the software design principles for a good maintainable design. All the changes in the system design should be localized, so that, it should have a minimal effect on other parts of the system. A small portion of code from the existing system is given below. This code is observed to be loosely cohesive. You are required to apply the software design principles and make the code highly cohesive.

class course {
    private:
         string course_code;
         string course_name;
         int credit_hours;
         int enrolled_student;
         int student_id;
         string student_name;
         int studentCurrentSemster;
         float student_gpa;
             
   public:
      void setCourseCode(string);
      void setCourseName(string);
      void setCreditHours(int);
      void countEnrolledStudent();
      void setStudentId(int);
    
      string getCourseCode();
      string getCourseName();
      int getCreditHours();
      int getStudentId();
      int getStudentCurrentSemster();
};

Ans:
click on download file link to get answer .

No comments:

Post a Comment