Project 2

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

HOMEWORK(Assignment 3 + 4)

Assignment 3:
Waterfall model:
The waterfall model is a classical model used in system development life
cycle to create a system with a linear and sequential approach. It is termed as
waterfall because the model develops systematically from one phase to
another in a downward fashion. This model is divided into different phases
and the output of one phase is used as the input of the next phase. Every
phase has to be completed before the next phase starts and there is no
overlapping of the phases. The sequential phases described in the
Sommerville and Roger S. Pressman Waterfall model have slightly different
points. The sequential phases are:
- Requirements analysis and definition  System and software design 
Implementation and unit testing  Integration and system testing 
Operation and maintenance (Sommerville)
- Communication  Planning  Modeling  Construction  Deployment
(Pressman)
Some advantages of the waterfall model are: easy to use, simple and
understandable; easy to manage as each phase has specific outputs and
review process; clearly-defined stages; works well for smaller projects
where requirements are very clear; process and output of each phase are
clearly mentioned in the document.
Besides, there are also disadvantages are: it doesn’t allow much reflection or
revision; risk and uncertainty are high; not advisable for complex and object-
oriented projects; changing requirements can’t be accommodated in any
phase and there is a chance that challenges and risks at earlier phases are not
identified. So it is not friendly to customers who want to change
requirements constantly because it needs the exact requirements from the
first stage.
We should only use the waterfall model when the requirements are very well
known, clear and fixed; product definition is stable; technology is understood;
there are no ambiguous requirements; ample resources with required expertise
are available freely and the project is short.
Example: Waterfall model was the preferred approach:
Development of Department Of Defense (DOD), military and aircraft programs
followed Waterfall model in many organizations. This is because of the strict
standards and requirements that have to be followed. In such industries, the
requirements are known well in advance and contracts are very specific about
the deliverable of the project. DOD Agencies typically considered Waterfall
model to be compatible with their acquisition process and rigorous oversight
process required by the government.

Programming Assignment

package exercise1411;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JCheckBox;
import javax.swing.border.EmptyBorder;

public class Exercise1411 extends JFrame {


private JPanel panel;
private Box box1, box2, box5, box6, box7;
private JComboBox combo;

String names[] = { "High", "Low" };


public Exercise1411()
{
super("Printer");
Container container = getContentPane();
container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
box1 = Box.createVerticalBox();
box1.add(new JCheckBox("Image"));
box1.add(new JCheckBox("Text"));
box1.add(new JCheckBox("Code"));

box2 = Box.createVerticalBox();
box2.add(new JRadioButton("Selection"));
box2.add(new JRadioButton("All", true));
box2.add(new JRadioButton("Applet"));

Component radioc[] = box2.getComponents();

ButtonGroup radiobutton = new ButtonGroup();


for (int i = 0; i < radioc.length; i++)
radiobutton.add((AbstractButton)(radioc[i]));

JPanel box3 = new JPanel();


box3.setLayout(new GridLayout(4, 1, 5, 5));
box3.add(new JButton("Ok"));
box3.add(new JButton("Cancel"));
box3.add(new JButton("Setup..."));
box3.add(new JButton("Help"));

Dimension size = box3.getPreferredSize();


box3.setMaximumSize(size);

JPanel box4 = new JPanel();


box4.setLayout(new FlowLayout());
box4.add(new JLabel("Print Quality: "));
box4.add(new JComboBox(names));
box4.add(new JCheckBox("Print to File"));

box5 = Box.createHorizontalBox();
box5.add(Box.createHorizontalGlue());
box5.add(box1);
box5.add(Box.createHorizontalStrut(20));
box5.add(box2);
box5.add(Box.createHorizontalGlue());

box6 = Box.createHorizontalBox();
box6.add(new JLabel("Printer: MyPrinter"));
box6.add(Box.createHorizontalGlue());

box7 = Box.createVerticalBox();
box7.add(Box.createVerticalGlue());
box7.add(box6);
box7.add(box5);
box7.add(box4);
box7.add(Box.createVerticalGlue());

container.add(Box.createHorizontalGlue());
container.add(box7);
container.add(box3);
container.add(Box.createHorizontalGlue());

setSize(400, 165);
setVisible(true);
}
public static void main(String args[])
{
Exercise1411 application = new Exercise1411();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

package exercise1414;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Exercise1414 extends JFrame


{
private int number, guess;
private int highest, lowest;
private JTextField guessInput;
private JTextField message;
private JLabel text1, text2;
private JButton newGame;
public Exercise1414()
{
super("Guess Game");
text1 = new JLabel("I have a number between 1 and 1000.");
text2 = new JLabel("Can you guess my" +
" number? Enter your Guess: ");
highest = 0;
lowest = 1000;
guessInput = new JTextField(5);
guessInput.addActionListener(new GuessHandler());
message = new JTextField("<-------------", 15);
message.setEditable(false);
newGame = new JButton("New Game");
newGame.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e)
{
message.setText("<-------------");
guessInput.setText("");
guessInput.setEditable(true);
theGame();
}
}
);
Container c = getContentPane();
c.setLayout(new FlowLayout());
c.add(text1);
c.add(text2);
c.add(guessInput);
c.add(message);
c.add(newGame);
setSize(300, 200);
show();
theGame();
}

public void theGame()


{
number = (int)(Math.random() * 1000 + 1);
}

public static void main(String[] args)


{
Exercise1414 app = new Exercise1414();
app.addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
}
class GuessHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
guess = Integer.parseInt(guessInput.getText());
if (guess > number)
{
message.setText("Too High");
if (guess < lowest) {
lowest = guess;
setBackground(Color.red);
}
else
setBackground(Color.blue);
}
else if (guess < number) {
message.setText("Too Low");
if (guess > highest) {
highest = guess;
setBackground(Color.red);
}
else
setBackground(Color.blue);
}
else {
message.setText("Correct!");
setBackground(Color.white);
guessInput.setEditable(false);
lowest = 1000;
highest = 0;
}
repaint();
}
}

Assignment 4:
2.1: Explain why other systems within a system’s environment can have
unanticipated effects on the functioning of a system.
System is the collection of different independent component that work together to
perform the specific task. In a system environment, there are different small and
large components or entities that work together to give the single product. Because
of dependency between different components, there may arise the problems in the
system. If one system gets fail, it can harm to the overall system output. Basically,
in large organization, main system is need to coordinate with other sub system to
complete its task. It may lead to the risk. System in the same environment
interrupts on the execution of other system. So other system in the system’s
environment can have unanticipated effects because they have relationships with
the system over and above whatever formal relationships are defined in the system
specification.
2.2: Explain why specifying a system to be used by emergency services for
disaster management is an inherently wicked problem.
Disaster management is not a static system because the number of variables comes
into the play. Even the same disaster in two different place may have different
consequences or series of activities that is going to affect the places. Also same
system may not specify all type of the disaster problem in a single system and no
place in earth is totally safe to say this type of disaster may not happen here
depending upon the environment in some cases. So, in such disaster emergency
service of any type has to be enabled not just the specified type. Hence such
specification of the system for the disaster management system is inherently
wicked problems.
2.5: Consider a security system that is an extended version of the system
shown in Figure 2.6, which is intended to protect against intrusion and to
detect fire. It incorporates smoke sensors, movement sensors, door sensors,
video cameras under computer control, located at various places in the
building, an operator console where the system status is reported, and
external communication facilities to call the appropriate services such as the
police and fire departments. Draw a block diagram of a possible design for
such a system.

You might also like