View
364
Download
1
Category
Preview:
Citation preview
Computer Science
Software Engineering
1393
Data Flow Control
& Proposal T-Card Game Programming
Result Sheet
Author: Sayed Ali Daniyal
Teacher : Halim Halim
Contents Software Development Life Cycle (SDLC) ........................................................................................................ 3
1. Conceptual Planning ....................................................................................................................................... 3
1. Planning and Requirements Definition ............................................................................................................ 3
3. Design ............................................................................................................................................................ 3
4. Development and Testing ............................................................................................................................... 3
5. Implementation ............................................................................................................................................. 4
6. Operations and Maintenance ......................................................................................................................... 4
7. Disposition ..................................................................................................................................................... 4
Software Development Life Cycle in to tree part ................................................................................................. 4
1. Activity Diagram (DFD) ............................................................................................................................ 4
2. Class Diagram (ERD) ................................................................................................................................ 4
3. Conceptual Diagram .................................................................................................................................. 4
What are Data Flow Diagrams? .............................................................................................................................. 4
Defining DFD Components .................................................................................................................................... 5
Entity ................................................................................................................................................................ 5
Process .............................................................................................................................................................. 5
Data Store......................................................................................................................................................... 6
Data Flow ......................................................................................................................................................... 6
Process for Developing DFDs................................................................................................................................. 6
Developing the Level 0 DFD .................................................................................................................................. 7
Revising the Level 1 DFD ...................................................................................................................................... 7
Advantages and Disadvantages of DFDs ................................................................................................................. 7
Strengths ........................................................................................................................................................... 7
Disadvantages .................................................................................................................................................... 7
Proposal ................................................................................................................................................................. 9
Introduction ..................................................................................................................................................... 9
Background ...................................................................................................................................................... 9
Tools to be used ................................................................................................................................................ 9
Time Plane: ....................................................................................................................................................... 9
Charter of Our Project: ....................................................................................................................................... 9
Key Schedule Milestone: .................................................................................................................................. 10
Budget Information: ......................................................................................................................................... 10
Project Manager: ............................................................................................................................................. 10
Project Objective: ............................................................................................................................................ 10
T Card Code......................................................................................................................................................... 11
ConnectionToDB .............................................................................................................................................. 17
SwingAnimation ............................................................................................................................................... 18
Software Development Life Cycle (SDLC) The SDLC process was designed to ensure end-state solutions meet user requirements in support of
business strategic goals and objectives. In addition, the SDLC also provides a detailed guide to help
Program Managers with ALL aspects of IT system development, regardless of the system size and
scope. The SDLC contains a comprehensive checklist of the rules and regulations governing IT
systems, and is one way to ensure system developers comply with all applicable Government
regulations, because the consequences of not doing so are high and wide ranging. This is especially
true in the post 9/11 environment where larger amounts of information are considered sensitive in
nature, and are shared among commercial, international, Federal, state, and local partners.
The seven-step process contains a procedural checklist and the systematic progression required to
evolve an IT system from conception to disposition. The following descriptions briefly explain each
of the seven phases of the SDLC:
1. Conceptual Planning
This phase is the first step of any system's life cycle. It is during this phase that a need to acquire or
significantly enhance a system is identified, its feasibility and costs are assessed, and the risks and
various project-planning approaches are defined. Roles and responsibilities for the Asset Manager,
Sponsor's Representative, System Development Agent (SDA), System Support Agent (SSA), and
other parties in SDLC policy are designated during this stage and updated throughout the system's life
cycle.
1. Planning and Requirements Definition
This phase begins after the project has been defined and appropriate resources have been committed.
The first portion of this phase involves collecting, defining and validating functional, support and
training requirements. The second part is developing initial life cycle management plans, including
project planning, project management, Configuration Management (CM), support, operations, and
training management.
3. Design
During this phase, functional, support and training requirements are translated into preliminary and
detailed designs. Decisions are made to address how the system will meet functional requirements. A
preliminary (general) system design, emphasizing the functional features of the system, is produced
as a high-level guide. Then a final (detailed) system design is produced that expands the design by
specifying all the technical detail needed to develop the system.
4. Development and Testing
During this phase, systems are developed or acquired based on detailed design specifications. The
system is validated through a sequence of unit, integration, performance, system, and acceptance
testing. The objective is to ensure that the system functions as expected and that sponsor's
requirements are satisfied. All system components, communications, applications, procedures, and
associated documentation are eveloped/acquired, tested, and integrated. This phase requires strong
user participation in order to verify thorough testing of all requirements and to meet all business
needs.
5. Implementation
During this phase, the new or enhanced system is installed in the production environment, users are
trained, data is converted (as needed), the system is turned over to the sponsor, and business
processes are evaluated. This phase includes efforts required to implement, resolve system problems
identified during the implementation process, and plan for sustainment.
6. Operations and Maintenance
The system becomes operational during this phase. The emphasis during this phase is to ensure that
sponsor needs continue to be met and that the system continues to perform according to
specifications. Routine hardware and software maintenance and upgrades are performed to ensure
effective system operations. User training continues during this phase, as needed, to acquaint new
users to the system or to introduce new features to current users. Additional user support is provided,
as an ongoing activity, to help resolve reported problems.
7. Disposition
This phase represents the end of the system's life cycle. It provides for the systematic termination of a
system to ensure that vital information is preserved for potential future access and/or reactivation.
The system, when placed in the Disposition Phase, has been declared surplus and/or obsolete and has
been scheduled for shutdown. The emphasis of this phase is to ensure that the system (e.g.,
equipment, parts, software, data, procedures, and documentation) is packaged and disposed of in
accordance with appropriate regulations and requirements.
Each column in the graphic represents an individual phase. The documents in each phase are created
and maintained throughout the rest of the development cycles until the final disposition of the project.
Although this indicates the process is linear, it is not. It is iterative and once a project is deployed, the
management of the project may return to requirements gathering to start all over again.
Software Development Life Cycle in to tree part
1. Activity Diagram (DFD)
2. Class Diagram (ERD)
3. Conceptual Diagram
What are Data Flow Diagrams?
Data flow diagrams illustrate how data is processed by a system in terms of inputs and outputs.
Data Flow Diagram reveals relationships among and between the various components in program or
system. DFDs are an important technique for modeling a system high-level detail by showing how
input data is functional transformations .DFDs consist of four major components: entities, processes,
data stores and data flows. The symbols used to depict how these components interact in a system are
simple and easy to understand; however, there are several DFD models to work from, each having its
own Symbology. DFD syntax does remain constant by using simple verb and noun constructs. Such a
syntactical relationship of DFDs makes them ideal for object-oriented analysis and parsing functional
specifications into precise DFDs for the system analyst.
Defining DFD Components
DFDs consist of four basic components that illustrate how data flows in a system: entity, process,
data store, and data flow.
Defining Data Flow Diagrams (DFDs) When it comes to conveying how information data flows
through systems (and how that data is transformed in the process), data flow diagrams (DFDs) are the
method of choice over technical descriptions for three principal reasons.
1. DFDs are easier to understand by technical and nontechnical audiences
2. DFDs can provide a high level system overview, complete with boundaries and connections to
other systems
3. DFDs can provide a detailed representation of system components
DFDs help system designers and others during initial analysis stages visualize a current system or one
that may be necessary to meet new requirements. Systems analysts prefer working with DFDs,
particularly when they require a clear understanding of the boundary between existing systems and
postulated systems. DFDs represent the following:
1. External devices sending and receiving data
2. Processes that change that data
3. Data flows themselves
4. Data storage locations
Entity
An entity is the source or destination of data. The source in a
DFD represents these entities that are outside the context of the
system. Entities either provide data to the system (referred to as a
source) or receive data from it (referred to as a sink). Entities are
often represented as rectangles (a diagonal line across the right-
hand corner means that this entity is represented somewhere else
in the DFD). Entities are also referred to as agents, terminators,
or source/sink.
Process
The processes the manipulation or work that transforms data,
performing computations, making decisions (logic flow), or
directing data flows based on business rules. In other words, a
process receives input and generates some output. Process names
(simple verbs and dataflow names, such as “Submit Payment” or
“Get Invoice”) usually describe the transformation, which can be performed by people or machines.
Processes can be drawn as circles or a segmented rectangle on a DFD, and include a process name
and process number.
Data Store
A data stories where a process stores data between processes for later retrieval by that same process
or another one. Files and tables are considered data stores. Data store names (plural) are simple but
meaningful, such as “customers,” “orders,” and “products.” Data stores are usually drawn as a
rectangle with the right hand side missing and labeled by the name of the data storage area it
represents, though different notations do exist.
Data Flow
Data Flows the movement of data between the entity, the process, and the data store. Data flow
portrays the interface between the components of the DFD. The flow of data in a DFD is named to
reflect the nature of the data used (these names should also be unique within a specific DFD). Data
flow is represented by an arrow, where the arrow is annotated with the data name.
Process for Developing DFDs
Data flow diagrams can be expressed as a series of levels. We begin by making a list of business
activities to determine the DFD elements (external entities, data flows, processes, and data stores).
Next, a context diagrams constructed that shows only a single process (representing the entire
system), and associated external entities. The Diagram-0, or Level 0 diagram, is next, which reveals
general processes and data stores. Following the drawing of Level 0 diagrams, child diagrams will be
drawn (Level 1 diagrams) for each process illustrated by Level 0 diagrams.
Developing the Level 0 DFD
At this point, you should have a good idea of the system boundary. All components within the system
boundary are included within a single system/process box in the DFD. External entities lie outside the
system boundary; internal entities will become locations for processes. The data flow arrows to and
from the external entities will indicate the system’s relationship with its environment. Remember that
information always flows to or from a process, an external entity, or a data store. You can use a
dashed line to show data flows between external entities. that are strictly external to the system at
hand if it will help make the DFD easier to understand.
Revising the Level 1 DFD
Once you’ve finished your first attempt at a Level 1 DFD, review it for consistency and refine it for
balance by asking yourself these questions:
1. Do the Level 1 processes correspond with the major functions that a user expects from the system?
2. Is the level of detail balanced across the DFD?
3. Can some processes be merged?
4. Can I remove data stores not shared by more than one process?
5. Have I avoided crossed data flow lines by making use of duplicated components (external entities
and data stores)
Advantages and Disadvantages of DFDs
Strengths
As we have seen, the DFD method is an element of object-oriented analysis and is widely used. Use
of DFDs promotes quick and relatively easy project code development. DFDs are easy to learn with
their few-and simple-to-understand symbols (once you decide on a particular DFD model). The
syntax used for designing DFDs is simple, employing English nouns or noun adjective-verb
constructs.
Disadvantages
DFDs for large systems can become cumbersome, difficult to translate and read, and be time
consuming in their construction. Data flow can become confusing to programmers, but DFDs are
useless without the prerequisite detail: a Catch-22 situation. Different DFD models employ different
symbols (circles and rectangles, for example, for entities).
User Open The Game
User Open The Game
User Validation And
Choose Friend(TEAM)
Deviding Cards As Random
Player One
Choose Score=+8
Player Two Can choose Score (=+8) or
Scape
Player two Can’t choose Score Equal or lsee than
Player one
Choose ScoreEscape
Player Two
Choose Score According to Previous
Player
The Process in the Loop Will
Repeat for next two Player
Player One Shoot the First Card (IT IS COLOR IN THIS ROUND)
It should be A if exist
Player One Shoot the First Card (IT IS COLOR IN THIS ROUND)
It should be A if exist
Player two Shoot the First Card (IT SHOULD BE SAME GROUP TO FIRST CARD IF EXIST)
It should be A if exist
Player two Shoot the First Card (IT SHOULD BE SAME GROUP TO FIRST CARD IF EXIST)
It should be A if exist
Player three Shoot the First Card (IT SHOULD BE SAME GROUP TO FIRST CARD IF EXIST)
It should be A if exist
Player three Shoot the First Card (IT SHOULD BE SAME GROUP TO FIRST CARD IF EXIST)
It should be A if exist
Player four Shoot the First Card (IT SHOULD BE SAME GROUP TO FIRST CARD IF EXIST)
It should be A if exist
Player four Shoot the First Card (IT SHOULD BE SAME GROUP TO FIRST CARD IF EXIST)
It should be A if exist
In this Period we have two Team Each team Consists two Players
Color has Power on other Categories.
Each card that has the more NUMBER win in the round.
Scores store for two Team
If: A Team can received the declared scores, the scores will add to their account.
Else:
Scores are doubled and add to apposite Team
Game will Finished up to 100 scores
Proposal
Introduction
Teka Game is very common and a popular form of entertainment in this region especially for the
young generation. Most of learner play Teka game in their free time to refresh their selves for
further study. Traditionally they have to buy cards and find suitable place to play the Teka. But in
some places or sometimes there is no card or suitable place for Teka players, so our automated
computerized solution of Teka game can assist players regardless the place suitability issue.
One example of Teka game is Hearts in windows 7 which is for one person. In this project we
planned our project milestones and the outcome should be a network game more likely Hearts
where four person can play together at a time.
Background
In T-card game project we design the Teka game for those who want to play the Teka game in
computer and there regardless playing cards or suitable place. Developing Card Game based on Java.
Where 4 players can play this game on Network. Game has some specific Laws. Players play with 52
cards which must be divided in to 4 categories. After starting, cards must arranged randomly. Each
Player will have 13 cards. The Right side player of who starts the dividing, should declare his scores
more or equal 8 or escape. If first Player escaped, Second Player should declare 8 scores, more or
escape. Else if first Player choose scores, the second player should choose scores more than first
player or scape (The above term will accommodate on each two reminded players).
Tools to be used
J2sdk (Java 2 software development kit, compiler)
IDE (eclipse , J creator, net beans …)
Photoshop
Logo Designer
Time Plane:
Data gathering must be finished in May 31, 2014
Designing of Frame and logo and layouts at to June 9, 2014
Working on game from June 10 until September 31, 2014
Testing of the game from October 1, until October 30, 2014
Charter of Our Project:
Project Title: T-card
Date of Authorization: May 1, 2014
Project Start Date: May 8, 2014
Project Finish Date: October 31, 2014
Key Schedule Milestone:
Data gathering must be finished in May 31, 2014
Designing of Frame and logo at to June 9, 2014
Working on game from June 10 until September 31, 2014
Testing of the game from October 1, until October 30, 2014
Task Start Date Finished Date Duration
First phase of the Project
1 Building the Main Frame 5/17/2014 5/23/2014 1 week
2 Insert Images to Main Frame and set Action to Menu Buttons
5/24/2014 5/30/2014 1 week
3 Making Algorithm of the Game for one User
5/31/2014 6/6/2014 1 week
Implement The Algorithm 6/7/2014 7/3/2014 4 week
Network Programming and make the Game for 4 Players
Second Phase of the Project
Budget Information:
This project is supported by Computer Science Faculty of Balkh University and there is no budget for this
project.
Project Manager:
Ahmad Shah, ahmadshahsharifi3@gmail.com
Project Objective:
The objective of this project is making a game for those who like Teka game and it will be a good
experience for our group member to make a game in java programming language which support
network programming.
Main Project Success Criteria:
This Project must be completed in time.
T Card Code
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.Random;
public class T_Card extends JFrame implements ActionListener, MouseListener {
Container con;
JButton b4,b5,b6;
JButton b1,b2,b3;
JButton btnDist;
JPanel jpe,jpc,jpw,jpn,jps;
Icon cf1,cf2,cf3, north_c,west_c;
Icon[] c;
int[] randomList;
JButton[] bu;
Dimension size_s, size_n,size_w, size_ce;
JLabel lblMouseStatus;
int a,b,counter=0,overAllCounter=0;
Thread th;
public void createRandomList() {
randomList=new int[53];
Random r;
int repeat=0;
int ran_num;
int counter=1;
int i;
r=new Random();
while(counter<=52){
repeat=0;
ran_num=r.nextInt(52)+1;
randomList[counter]=ran_num;
if(counter>1)
for(i=counter-1;i>=1;i--)
if(randomList[counter]==randomList[i])
repeat=1;
if(repeat==0)
counter++;
}
}
public T_Card(){
super("T-Card");
createRandomList();
con = getContentPane();
con.setLayout(new BorderLayout());
setSize(1000,750);
setLocation(20,0);
setDefaultCloseOperation(EXIT_ON_CLOSE);
cf1=new ImageIcon("c1.png");
cf2=new ImageIcon("c2.PNG");
cf3=new ImageIcon("c3.PNG");
north_c=new ImageIcon("nor.PNG");
west_c=new ImageIcon("w_s.PNG");
//Center
jpc=new JPanel();
jpc.setLayout(null);
bu=new JButton[53];
c=new Icon[53];
btnDist=new JButton("Let Start");
btnDist.addActionListener(this);
btnDist.setBounds(200,430,100,70);
jpc.add(btnDist);
jpc.setBackground(Color.DARK_GRAY);
size_ce=new Dimension(500,0);
jpc.setPreferredSize(size_ce);
setDefaultLookAndFeelDecorated(true);
con.add(jpc,BorderLayout.CENTER);
// con.add(new JButton("Button east"),BorderLayout.EAST);
// for(int i=1;i<=52;i++)
th =new Thread();
setVisible(true);
}
public void mouseEntered(MouseEvent me) {
for(int i=1;i<=13;i++){
if(me.getSource()==bu[i])
bu[i].setBounds(100+i*50,0,80,100);
}
}
public void mouseExited(MouseEvent me) {
for(int i=1;i<=13;i++){
if(me.getSource()==bu[i])
bu[i].setBounds(100+i*50,30,80,100);
}
// lblMouseStatus.setText("Mouse Exited @{"+me.getX() +" ,"+me.getY()+" }");
}
public void mouseClicked(MouseEvent me){
}
public void mousePressed(MouseEvent me){
}
public void mouseReleased(MouseEvent me){
}
//South site
public void dist_Card_south() {
jps=new JPanel();
jps.setLayout(null);
jps.setPreferredSize(new Dimension(0,150));
for(int i=1;i<=13;i++){
c[i]=new ImageIcon("c"+randomList[i]+".png");
// c[x]=new ImageIcon("nor.png");
bu[i]=new JButton(c[i]);
bu[i].setBounds(100+i*50,30,80,100);
bu[i].addMouseListener(this);
bu[i].addActionListener(this);
jps.add(bu[i]);
con.add(jps,BorderLayout.SOUTH);
jps.setVisible(true);
setVisible(true);
}
setDefaultLookAndFeelDecorated(true);
}
//north site
public void dist_Card_North(){
jpn=new JPanel();
jpn.setLayout(null);
jpn.setPreferredSize(new Dimension(0,150));
for(int i=14;i<=26;i++){
c[i]=new ImageIcon("c"+randomList[i]+".png");
bu[i]=new JButton(c[i]);
bu[i].setBounds(100+(i-13)*50,30,80,100);
bu[i].addMouseListener(this);
bu[i].addActionListener(this);
jpn.add(bu[i]);
}
setDefaultLookAndFeelDecorated(true);
con.add(jpn,BorderLayout.NORTH);
jpn.setVisible(true);
setVisible(true);
} //east site
public void dist_Card_east(){
jpe=new JPanel();
jpe.setLayout(null);
jpe.setPreferredSize(new Dimension(150,0));
for(int i=27;i<=39;i++){
c[i]=new ImageIcon("L"+randomList[i]+".png");
bu[i]=new JButton(c[i]);
bu[i].setBounds(30,30+(i-26)*20,100,80);
bu[i].addMouseListener(this);
bu[i].addActionListener(this);
jpe.add(bu[i]);
}
setDefaultLookAndFeelDecorated(true);
con.add(jpe,BorderLayout.EAST);
jpe.setVisible(true);
setVisible(true);
} //west site
public void dist_Card_west(){
jpw=new JPanel();
jpw.setLayout(null);
jpw.setPreferredSize(new Dimension(150,0));
for(int i=40;i<=52;i++){
c[i]=new ImageIcon("c"+randomList[i]+".png");
bu[i]=new JButton(c[i]);
bu[i].setBounds(30,10+(i-39)*20,80,100);
bu[i].addMouseListener(this);
bu[i].addActionListener(this);
jpw.add(bu[i]);
try{
th.sleep(10);
}
catch(InterruptedException e){}
//setDefaultLookAndFeelDecorated(true);
con.add(jpw,BorderLayout.WEST);
jpw.setVisible(true);
//setVisible(true);
}
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==btnDist){
dist_Card_east();
dist_Card_North();
dist_Card_south();
dist_Card_west();
jpc.setVisible(false);
} else {
for(int i=1;i<=52;i++)
if(e.getSource()==bu[i]){
bu[i].setVisible(false);
if(counter%4==0){
jpc.setVisible(false);
jpc=new JPanel();
}
//bu[i].setBounds(60,20,80,100);
jpc.add(bu[i]);
bu[i].removeMouseListener(this);
// bu[i].removeActionListener(this);
bu[i].setVisible(true);
// size_ce=new Dimension(500,0);
//jpc.setPreferredSize(size_ce);
con.add(jpc,BorderLayout.CENTER);
//bu[i].setVisible(false);
counter++;
overAllCounter++;
if(overAllCounter==53)
jpc.setVisible(false);
}
}
//JOptionPane.showMessageDialog(null,"the first button");
}
public static void main(String[] args) {
T_Card obj= new T_Card();
}
}
ConnectionToDB
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class ConnectionToDB {
Connection conn;
private Statement st;
private ResultSet rs;
public ConnectionToDB(){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn=DriverManager.getConnection("jdbc:odbc:DicDatabase");
st=conn.createStatement();
}catch(Exception e){
System.out.print("error Connection");
}
}
public void getdata(){
try{ rs=st.executeQuery("select * from game ");
while(rs.next()){
String user=rs.getString("Username");
System.out.print(" "+user);
}
}catch(Exception e){
}
}
public static void main(String args[]){
ConnectionToDB fi=new ConnectionToDB();
fi.getdata();
}
}
SwingAnimation
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SwingAnimation{
Thread th;
ImageIcon images;
JFrame frame;
JLabel lbl;
int i = 0;
int j;
public static void main(String[] args){
SwingAnimation sa = new SwingAnimation();
}
public SwingAnimation(){
frame = new JFrame("Animation Frame");
th = new Thread();
lbl = new JLabel();
Panel panel = new Panel();
panel.add(lbl);
frame.add(panel, BorderLayout.CENTER);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SwingAnimator();
}
public void SwingAnimator(){
try{
for(i = 1; i <= 5; i++){
images = new ImageIcon("c" + i + ".png");
lbl.setIcon(images);
th.sleep(1000);
}
}
catch(InterruptedException e){
}
}
}
Recommended