Professional Documents
Culture Documents
Sda Lab Manual2
Sda Lab Manual2
PREPARED BY
Lab manual is prepared by Assistant Professor Umar Mahmud under the supervision of Head of Department
Professor Dr. Muhammad Shaheen.
GENERAL INSTRUCTIONS
a. Students are required to maintain the lab manual with them till the end of the semester.
b. All readings, answers to questions and illustrations must be solved on the place provided. If more space is
required, then additional sheets may be attached. You may add screen print to the report by using the
‘Print Screen’ command on your keyboard to get a snapshot of the displayed output.
c. It is the responsibility of the student to have the manual graded before deadlines as given by the instructor.
d. Loss of manual will result in re submission of the complete manual.
e. Students are required to go through the experiment before coming to the lab session.
f. Students must bring the manual in each lab.
g. Keep the manual neat clean and presentable.
h. Plagiarism is strictly forbidden. No credit will be given if a lab session is plagiarised and no re-submission
will be entertained.
i. Marks will be deducted for late submission.
j. You need to submit the report even if you have demonstrated the exercises to the lab instructor or shown
them the lab report during the lab session.
VERSION HISTORY
Date Update By Details
July 2018 Umar Mahmud Version 1.0. Initial draft prepared and experiments outlined.
Jan 2020 Umar Mahmud Version 2.0. Experiments are revised and questions are
reviewed. Experiments are revised for MS Visio 2106
Aug 2023 Dr. Maryam Kausar Version 3.0 Details were added and sequence of the manual
was updated. Project was added.
MARKS
1 INTRODUCTION TO MS VISIO 10
2 USE CASE DIAGRAMS 10
4 DOMAIN MODEL 10
5 CLASS DIAGRAM 10
7 ACTIVITY DIAGRAM 10
11 DESIGN PATTERNS 10
12 FACTORY PATTERN 10
13 OBSERVER PATTERN 10
14 MODULAR DESIGN 10
GRAND TOTAL
LIST OF EXPERIMENTS
EXERCISE 1.1 [4] Cerate a program for language of your choice. The program does the
following: -
• First it asks user to enter the code of the item purchased by a customer.
• If item code is valid, the description and price for that code is displayed on the screen.
• If item code is invalid, message is displayed “Item Code doesn’t exist”.
• Then it asks for the quantity of the item code entered. If quantity is less than zero, it prompts user to
enter quantity greater than zero.
• It displays the subtotal thereafter.
• Moreover, it keeps on accepting item codes until ‘0’ is pressed.
• Consequently, it displays the total amount due.
• Then, it asks the user to tender the amount of cash of the customer. It should not accept amount of
cash less than the amount due.
• Finally, it displays the change. Show
code and outcome screens here: -
CODE:
package javaapplication144;
import java.util.Scanner;
class shop
{
boolean check(int code)
{
return true;
}
void buy()
{
Scanner scan = new Scanner(System.in);
shop ob = new shop();
System.out.println("Enter the code of item");
int code = scan.nextInt();
if(ob.check(code))
{
System.out.println("detail of product");
System.out.println("Enter item quantity");
int quantity=scan.nextInt();
if(quantity<=0)
{
System.out.println("enter quantity greater then 0");
}
else
{
System.out.println("subtotal of items");
}
}
}
public class JavaApplication144
{
1.2 [6]
Draw and submit a flowchart for a cashier program.
• Stock manager
• Ware house person
• Online transaction system
Description of Actors:
1. Sale Assistant:
sales assistant will be able to process an order by entering product numbers and required quantities into
the system. If stock is not available, the sales assistant will be able to create a backorder for the product
from a regional warehouse.
2. Customer:
Customer will be able to order items from the store. In-stock products will normally be collected
immediately by the customer from the store.
3. Delivery boy:
The products will then either be delivered direct from the regional warehouse to the customer's home
address by delivery boy or to the store for collection by the customer.
4. Store manager:
The store manager will be able at any time to print a summary report of sales in the store for a given
period, including assignment of sales to sales assistants in order to calculate weekly sales bonuses.
5. Stock manager:
The stock manager will be able to monitor stock levels and weekly run-rates in order to set minimum
stock levels and requisition products which fall below the minimum stock levels or for which demand
is anticipated.
6. Ware house person:
When the stock arrives, it will be booked in by the warehouse person.
7. Online transaction system:
Credit card transactions will be validated via an online card transaction system.
5. Provide receipt:
The sale assistant will provide valid receipt to customer.
2.3 [4]
Draw a use-case diagram of the above requirement specifications.
EXERCISE 2.4 [2] Write use case description table for each use case. A sample is given below: -
ID UC-4
Description The customer can search for clothes into the system. Customers can search by size,
price and colour.
ID UC-6
Description The delivery boy will deleiver item to customer address or the store
Description The sale assistant can create back order for currently un available products
Postcondition Sale assistant will get the item from another branch later successfully
ID UC-8
Description The sale assistant will provide all details name, id etc of product to customer
WEB RESOURCES
http://en.wikipedia.org/wiki/Use_Case_Diagram
http://office.microsoft.com/en-ca/visio-help/create-a-uml-use-case-diagram-HP081550218.aspx
http://www.math-cs.gordon.edu/courses/cs211/ATMExample/UseCases.html
24 Experiment –
5 Class Diagram
WEB RESOURCES
http://en.wikipedia.org/wiki/Class_diagram
http://www.tutorialspoint.com/uml/uml_class_diagram.htm
25 Experiment –
https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/
http://msdn.microsoft.com/en-us/library/dd409437.aspx
5 Class Diagram
26 Experiment –
7 Activity Diagram
27 Experiment –
EXPERIMENT 9 – MODEL VIEW CONTROLLER (MVC)
9.2: VIEW
Interface Design. Show here:
WEB RESOURCES
http://en.wikipedia.org/wiki/ Model–view–controller http://www.silverlightshow.net/items/Exploring-the-
Model-View-Controller-MVC-pattern.aspx http://www.slideshare.net/javierhumaran/model-view-controller-
mvc-27875933 http://poincare.matf.bg.ac.rs/~andjelkaz/pzv/cas4/mvc.pdf
EXERCISE 10.1 [10] Implement the MVC architecture designed in Experiment 9. Show
code and outcome here: - VIEW CLASS
public class LABTASK10 {
System.out.println("*************PROFESSOR CLASS
VIEW**************");
professor pr=new professor();
pr.setName("Sir Waqas "); pr.setId(101);
pr.setContact(03005227004);
System.out.println("Professor Name: "+pr.getName());
System.out.println("Professor id: "+pr.getId());
System.out.println("Professor contact: "+pr.getContact());
cr.setVenue("SE");
cr.setTitle("Principle of Management");
System.out.println("Professor name: "+cr.getInstructor());
System.out.println("Course Title: "+cr.getTitle());
System.out.println("Course Venue: "+cr.getVenue());
System.out.println("***************DEPARTMENT CLASS
VIEW**************");
department de=new department();
de.setId(19);
de.setName("Electrical Engineering ");
System.out.println("Dpertment Id: "+de.getId());
System.out.println("Department Name: "+de.getName());
MODEL CLASS
public public
void setName(String
class controllername){ {
this.name = name;
private student s;
} private professor p;
public void updateCourseOutline()
private course c; {
private department d; outline has been updated");
System.out.println("Course
// Logic for updating course outline
} public controller(student s, professor p, course c, department d)
public { classthis.scourse = s; this.p = p; this.c = c; this.d = d;
{ private} String title;
private String instructor;
private String
publicvenue;
void run() {
Scanner scanner = new Scanner(System.in);
public int
void setTitle(String title)
choice;
{ this.title = title;
} do {
// Display menu options
public void setInstructor(String
System.out.println("1.instructor)
Select Course");
{ this.instructor = instructor;
System.out.println("2. Fill Form");
} System.out.println("3. Register Course");
public void viewCourseavailability()
System.out.println("4. { Update Course Outline");
System.out.println("Check course
System.out.println("5. View availability");
Course Information");
Date date =System.out.println("6.
new Date(2024, 4, 9); View Department Information");
System.out.println(date.toString());
System.out.println("0. Exit");
// Logic for System.out.print("Enter
viewing course information your choice: ");
} } choice = scanner.nextInt();
public class department {
private int id; // private
Perform actions based on user choice
String name;
switch (choice) { case 1:
s.selectCourse();
public void setId(intbreak;id) {
this.id =
case 2:id;
} s.fillForm();
break; case 3:
s.registerCourse();
public void setName(String name) {
this.name = name; break;
} case 4:
p.updateCourseOutline();
public void caltotalstudents() {
break;
System.out.println("Total case 5:
students are: "+30);
c.viewCourseavailability();
// Logic for viewing department information
break;
}
CONTROLLER
System.out.println("Exiting...");
break; default:
System.out.println("Invalid choice. Please try again.");
}
} while (choice != 0);
}
}
FACTORY PATTERN
}
}
if(shapeType.equalsIgnoreCase("CIRCLE"))
{
return new Circle();
} else
if(shapeType.equalsIgnoreCase("RECTAN
GLE")){
return new Rectangle();
} else
if(shapeType.equalsIgnoreCase("SQUARE"
)){
return new Square();
}
return null;
}
}
o declares the factory method, which returns an object of type Product. Creator may also define a
default implementation of the factory method that returns a default ConcreteProduct object.
o may call the factory method to create a Product object.
• ConcreteCreator (Report, Resume) o overrides the factory method to
return an instance of a ConcreteProduct.
40 Experiment –
12 Factory Pattern
41 Experiment –
12 Factory Pattern
42 Experiment –
13 Observer Pattern
Patient module
Appointment module
1 1…*
1…*
1…*
1
1…*
Payment module
1…*
Doctor module 1…*
43 Experiment –
14 Modular Design
44 Experiment –