ESOF 322: Software Engineering I Homework 1 to 5 solutions

$120.00

Original Work ?

Download Details:

  • Name: HWs-n6fqu7.zip
  • Type: zip
  • Size: 15.88 MB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

ESOF 322: Software Engineering I Homework 1

Exercise 1 (4 pts)
1. What is polymorphism? Provide an example using source code
2. What is inheritance? Describe the differences between public vs private inheritance
3. What is encapsulation?
4. What is the difference between static vs dynamic binding?
Exercise 1 (8 pts)
i. Provide a definition for a prescribed lifecycle, and name two types of prescribed
lifecycles
ii. For each type provide an example (i.e. a use case)
Research Question (3 pts)
What does low coupling and high cohesion mean?

ESOF 322: Software Engineering I Homework 2

Exercise Part A (15 pts)
For each of the following (pseudo) code snippets provide the UML class diagram.
1. public class Student { (2pts)
private Assignment assignment;
}
public class Assignment {
private Student std;
}
2. public class Disk { (3pts)
private List< BackupAccess > entries;
}
public class BackupAccess {
private DiskShare x;
private List< Disk > disks;
}
public class DiskShare {
private Disk a;
private BackupAccess ba;
}
3. public class AmazonAccount{ (5pts)
private string name;
private Purchase[] entries;
private Category [] ctgrs;
}
public class Category {
private string name;
private DateTime createdDate;
}
public class Purchase{
private string name;
private Category[] categories;
private boolean isDeleted;
}
4. public abstract class Store { (5pts)
public void FetchStore(Article[] articles);
public abstract Article getInformation();
}
public interface Accounting {
void getAccountDetails();
Account updateAccountDetails();
}
public class MSUStore extends Store implements Accounting{
private string storeLocation;
public void store(Article[] articles) { Book b = new Book(); // other code …. }
public Article retrieve() { … }
}
Exercise Part B (15 pts)
Write pseudo code to describe the following UML class diagram:
Note: Different UML tools may have slight variations in notation. In this diagram, you
may ignore the small filled circle at the end of arrow heads. You may also ignore the
small icons next to attributes and methods.
Exercise Part C (5 pts)
Suppose we need to develop a system named ‘Retail System’. Draw a single use
case diagram capturing the following 4 use cases.
i) A manager can add a new product in the system.
ii) A manager can delete a product in the system.
iii) A manager can edit a product information in the system.
iv) Both use cases (i), (ii) and (iii) should reuse this new use case i.e., a product
should be available in the stock.

ESOF 322: Software Engineering I Homework 3

In this assignment, you are to design, then implement a program in Java (or your OO
language of choice) that uses the Strategy pattern to solve the following problem.
You would like to provide a system for your customer that allows them to choose any one
of three types of sorting algorithms (bubbleSort, mergeSort, insertionSort, quickSort,
etc.). Each of these sort algorithms provides a function ( sort() ) to sort information. You
would like to allow your customer to select any one of these sorting algorithms and allow
them to change the default algorithm dynamically. The customers of the sorting
behaviors are Inventory modules. There are potentially many Inventory modules, and
each may need to sort items using a different algorithm.
A) Design a UML class diagram to solve this problem. Use the Strategy Pattern.
B) Write code in your favorite OO language to implement your design. The various
sort() methods can be implemented as dummy methods. That is, just display a
statement that says what kind of sort you are using. The emphasis of this
homework is not on sorting techniques, rather on the Strategy pattern. The
Inventory modules can be names Inventory1, Inventory2, etc.
C) Create a UML sequence diagram that clearly exemplifies the creation/usage of any
Inventory product, its sorting execution, the runtime switching of algorithms, and
then a sort( ) call again.
You will test your code by creating a client program (i.e. a main function) where you
simulate the interaction between a client and the selection of an Inventory module. The
main function will request your selection of sorting then call sort() to execute the default
strategy to sort information. Then call setSortStrategy() on your Inventory object to
dynamically switch strategies to one of the other sorting alternatives and execute it.
Hand in to D2L as a zip file:
A UML class diagram of your design (part A) (11pts)
A file of your code in text format (part B). For example, hand in a .java or a .cpp
file that I could compile and run. Add a comment in your code that states how to
compile your code. (11pts)
The output of running your program that clearly shows the main function
executing the default strategy and the dynamic switching to another strategy.
Include print statements on every method to help instrument your code. Your
code should be well documented (but not excessively). (4pts)
A UML sequence diagram (part C) (4pts)

ESOF 322: Software Engineering I Homework 4

Exercise 1 (15 pts)
We have covered three design patterns in class (Strategy, Adapter, Observer). Pick two
design patterns (any two that you want –you can even do research on your own and
find another one you like!) and couple them.
Two design patterns are coupled when at least one class is a participant in both design
patterns.
a) Draw a UML class diagram that clearly shows the coupling. Please identify
which class(es) participates in multiple patterns.
b) Draw a UML Sequence diagram where you demonstrate the behavior of an
instance of the coupled class from the perspective of one pattern, then from the
perspective of the other pattern.
Exercise 2 (10 pts)
a) “Man in the Middle (MitM)” and “Cross-site scripting” are famous type of cyber
attacks, describe each of them with an example.

ESOF 322 Homework #5

Question 1 (25 pts)
In this question you will exercise your reverse engineering skills.
a) Download the source code for any Open Source system. You can typically search sites like SourceForge
to find an Open Source system. Make sure the system is written in Java. (10 pts)
1. What system did you download? (4 pts)
2. What does it do? (2 pts)
3. How many Lines of Code (LOC) does it have? How did you calculate this? (4 pts)
b) As an example, you can use this Design Pattern Finder tool
(https://www.softpedia.com/get/Programming/Other-Programming-Files/Design-Pattern-Finder.shtml)
to scan the code for potential realizations of many design patterns. Note that this tool only works in a
Windows system, so you will need a Windows machine or virtual machine.
If you do not have a Windows machine, you will have to use a machine in one of our labs or install virtual
machine software (i.e. VMware or VBox). Then create a virtual Windows system.
The tool should give you a hint of potential existence of design patterns in the code. Print out the output
of the Design Pattern tool for the Open Source system you chose. (15 pts)
1. Capture the output of the tool (without checking the “Search in file content” box) and print it. (2
pts)
2. How does this tool look for instances of design patterns? (4 pts)
3. Do you think the process used by the tool is correct? How would you do it? Be specific. (9 pts)
Question 2 (10 pts)
Create a control flowgraph for the sieve algorithm. To the left of the line numbers in the source code
clearly identify the nodes that will be used in your graph. Once you have identified the nodes, draw the
control graph. (4 pts)
1. /* Find all primes from 2-upper_bound using Sieve of Eratosthanes */
2.
3. #include
4. typedef struct IntList {
5. int value;
6. struct IntList *next;
7. } *INTLIST, INTCELL;
8. INTLIST sieve ( int upper_bound ) {
9.
10. INTLIST prime_list = NULL; /* list of primes found */
11. INTLIST cursor; /* cursor into prime list */
12. int candidate; /* a candidate prime number */
13. int is_prime; /* flag: 1=prime, 0=not prime */
14.
15. /* try all numbers up to upper_bound */
16. for (candidate=2;
17.
18. candidate <= upper_bound; 19. candidate++) { 20. 21. is_prime = 1; /* assume candidate is prime */ 22. for(cursor = prime_list; 23. 24. cursor; 25. cursor = cursor->next) {
26.
27. if (candidate % cursor->value == 0) {
28.
29. /* candidate divisible by prime */
30. /* in list, can’t be prime */
31. is_prime = 0;
32. break; /* “for cursor” loop */
33. }
34. }
35. if(is_prime) {
36.
37. /* add candidate to front of list */
38. cursor = (INTLIST) malloc(sizeof(INTCELL));
39. cursor->value = candidate;
40. cursor->next = prime_list;
41. prime_list = cursor;
42. }
43. }
44. return prime_list;
45. }
a) Provide a set of test cases that would give 100% Node Coverage (NC). (2 pts)
b) Provide a set of test cases that would give 100% Edge Coverage (EC). (2 pts)
c) Is 100% NC or 100% EC possible in general? Why, or why not? (2 pts)
Question 3 (10 pts)
Select any application (it can be either web or mobile app) that you use the most and propose 3 MRs
that can be used to test that application. Apply those MRs and share the results i.e. which MR(s) passed
and which of them failed? Also, share the url of the application you tested.
Question 4 (12 pts)
Given the following program:
Give test cases that will kill the following mutations (4pts each):