Nothing Special   »   [go: up one dir, main page]

Plate Distribution - Report

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

SHRI DHARMASTHALA MANJUNATHESHWARA COLLEGE

OF ENGINEERING & TECHNOLOGY

INDUSTRY ORIENTED PROGRAMMING PRACTICES PROJECT REPORT

ON

“PLATE DISTRIBUTION SYSTEM”

Submitted by

USN NAME
2SD18CS117 TEJASWINI P A
2SD18CS118 USHA NANDINI
2SD18CS119 VAIBHAV N
2SD18CS120 VARSHINI D

Under the Guidance of


Prof.Rani Shetty
Dept. of CSE, SDMCET, Dharwad

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


S.D.M. COLLEGE OF ENGINEERING & TECHNOLOGY,
DHARWAD-580002
2020-2021
PLATE DISTRIBUTION SYSTEM

Table of Contents

PROBLEM STATEMENT ......................................................................................1


CHAPTER 1: INTRODUCTION ............................................................................3
CHAPTER 2: DETAILED DESIGN ......................................................................4
CHAPTER 3: PROJECT SPECIFIC REQUIREMENTS .......................................7
CHAPTER 4: IMPLEMENTATION ......................................................................8
CHAPTER 5: RESULTS .......................................................................................14
CHAPTER 6: OUTCOMES…………………………………………………….17
CHAPTER 7: CONCLUSION ..............................................................................23

Page 1 of 23
Plate Distribution

PROBLEM STATEMENT

The proposed system is to develop and design a plate distribution system that
looks into the process of collection of plates that are arranged in a stack by
students who are standing in a queue.

Department of Computer Science and Engineering, SDMCET, Dharwad. 2


Plate Distribution

CHAPTER 1: INTRODUCTION

Every hostel has a mess. In the mess, the plates are arranged one on top of the
other (they are stacked up) and to collect these plates, the students have to stand
in a queue. The students enter the queue (insert), collect the plates and exit the
queue (delete).
By using the combination of stack and queue, a code has been written to
understand this routine easily.
The number of plates present in the stack after students pick the plates up from
the top (pop) and the staff place washed plates on the stack (push) can be easily
predicted. Also, if the number of plates present in the stack are sufficient for the
students standing in the queue, extra plates cannot be added.

Department of Computer Science and Engineering, SDMCET, Dharwad. 3


Plate Distribution
CHAPTER 2: DETAILED DESIGN

Department of Computer Science and Engineering, SDMCET, Dharwad. 4


Plate Distribution

State Diagrams

State Diagram for Stack

State Diagram for Queue

Department of Computer Science and Engineering, SDMCET, Dharwad. 5


Plate Distribution

Class Diagram

Department of Computer Science and Engineering, SDMCET, Dharwad. 6


Plate Distribution

CHAPTER 3: PROJECT SPECIFIC REQUIREMENTS

Hardware Requirements:

i3 Processor
256 MB Ram
512 KB Cache Memory
Hard Disk 10GB

Software Requirements:
Operating System : Windows
Web-Technology : Java

Non-functional Requirements:

• Maintainability
• Portability
• Readability
• Sufficiency and Completeness
• Consistency
• Adaptability

Department of Computer Science and Engineering, SDMCET, Dharwad. 7


Plate Distribution

CHAPTER 4: IMPLEMENTATION

Implementation is the stage where the theoretical design is turned into a working
system.

We have written the code in JAVA Language.


Java was designed to be easy to use and is therefore easy to write, compile,
debug, and learn. It is object oriented and platform-independent. Because of
Java's robustness, ease of use, cross-platform capabilities and security features, it
has become a language of choice for providing worldwide Internet solutions.

Design Specification:

1.void setSize(int size) : sets the size of the stack/queue(setter). It returns


nothing.
2.boolean isFull() : checks whether the stack/queue is Full or not. Return true if
stack/queue is full and false if stack/queue is not full.
3.boolean isEmpty() : checks whether the stack/queue is Empty or not. Return
true if stack/queue is empty and false if stack/queue is not empty.
4.int peek() : returns integer which is at the top of the stack or at the front of the
queue. If queue/stack is empty returns 0.
5.void insert(int x) : Stores integer x at the top of the stack or at the rear end of
the queue, prints the “Successful” message and returns nothing. If the
queue/stack is full it prints appropriate error message.
6.void delete() : removes the top of the stack or an element at the front end of the
queue with “Successful” message and returns nothing. If the queue/stack is empty
it prints the appropriate error message.

Department of Computer Science and Engineering, SDMCET, Dharwad. 8


Plate Distribution

Test Cases
StackTest

class StackTest {
void test() {
Stack stk = new Stack();
stk.setSize(3);

Test Case-1: State->Stack Empty


boolean result1 = stk.isEmpty();
stk.delete();
if(result1==true)
{
System.out.println("Test Case 1 is successful, Stack is empty");
}
else
{
System.out.println("Test case 1 is not successful, Stack is not
empty");
}

//Insert the plates into the stack


stk.insert(1);

Test Case-2: State->Stack NENF


if(stk.peek()!=0 && stk.isFull()==false)
{
System.out.println("Test case 2 is successful,stack is NENF");
}
else
{
System.out.println("Test case 2 is unsuccessful,stack is not NENF");
}

Department of Computer Science and Engineering, SDMCET, Dharwad. 9


Plate Distribution
System.out.println();
stk.insert(2);
stk.insert(3);

Test Case-3: State->Stack Full


stk.insert(4);
boolean result2 = stk.isFull();
if(result2==true)
{
System.out.println("Test Case 3 is successful, Stack is full");
}
else
{
System.out.println("Test Case 3 is not successful, Stack is not
full");
}

Test Case-4: State->TopPlate


System.out.println("The top most plate is 3");
if(stk.peek()==3)
{
System.out.println("Test Case 4 is successful ,3 is the top most
plate");
}
else
{
System.out.println("Test Case 4 is not successful ,3 is not the top
most plate");
}
//Remove the plates from stack
stk.delete();
stk.delete();
stk.delete();
}
}
Department of Computer Science and Engineering, SDMCET, Dharwad. 10
Plate Distribution

QueueTest
class QueueTest {
void test() {
Queue que = new Queue();
que.setSize(3);
Test Case-1: State->Queue Empty
que.delete();
boolean result1 = que.isEmpty();
if(result1==true)
{
System.out.println("Test Case 1 is successful,Queue is empty");
}
else
{
System.out.println("Test Case 1 is not successful, Queue is not
empty");
}
//Students entering the queue
que.insert(100);

Test Case-2: State->Queue NENF


if(que.peek()!=0 && que.isFull()==false)
{
System.out.println("Test case 2 is successful, Queue is NENF");
}
else
{
System.out.println("Test case 2 is not successful, Queue is not
NENF");
}
que.insert(101);
que.insert(102);

Test Case-3: State->Queue Full


Department of Computer Science and Engineering, SDMCET, Dharwad. 11
Plate Distribution
que.insert(103);
boolean result2 = que.isFull();
if(result2==true)
{
System.out.println("Test Case 3 is successful, Queue is full");
}
else
{
System.out.println("Test Case 3 is not successful, Queue is not full");
}

Test Case-4: State->FrontMember


System.out.println("First Member in the queue is 100");
if(que.peek()==100)
{
System.out.println("Test Case 4 is successful, Your turn has come");
}
else
{
System.out.println("Test Case 4 is not successful, Wait for your
turn");
}
//Exit the queue
que.delete();
que.delete();
que.delete();
}
}

Department of Computer Science and Engineering, SDMCET, Dharwad. 12


Plate Distribution
Execution of Stack Test Scripts

Execution of Queue Test Scripts

Department of Computer Science and Engineering, SDMCET, Dharwad. 13


Plate Distribution

CHAPTER 5: RESULTS

Student entering the queue:

Staff putting the plate back on the stack:

Department of Computer Science and Engineering, SDMCET, Dharwad. 14


Plate Distribution

When the number of plates the staff is putting back is greater than the number of students:

Student exiting the queue after collecting the plate:

Department of Computer Science and Engineering, SDMCET, Dharwad. 15


Plate Distribution

Student in the middle of the queue trying to exit:

Department of Computer Science and Engineering, SDMCET, Dharwad. 16


Plate Distribution

CHAPTER 6: OUTCOMES

STUDENT OUTCOMES:

• We learnt how to develop test cases and write a program to test reusable
objects.
• We learnt how to incorporate a lot of features we had studied in our code
and also learnt how to apply them in a business scenario.
• We got to practice Pair programming – an agile software development
technique. We learnt how to work in a team and coordinate with each other.

PROJECT OUTCOMES:

Through this project we were able to implement the following features:

Naming convention and consistency – The written code follows the naming
convention. The name of the package, classes, methods are given according to
their function. The code is uniform and consistent and hence is more reliable.

Package naming convention(lower case) -


Domain_name.company_name.project_name.program
Class naming convention : Camel casing
In our project we have used this convention as
com.sdmcet.iopp_project – package name
Array.java, Stack.java, Queue.java, Main.java-Class names

Department of Computer Science and Engineering, SDMCET, Dharwad. 17


Plate Distribution
Readable and Effective – The written code is readable and its intention can
clearly be communicated to the reader. This is because of the following factors
included in the code:

• Usage of whitespace to separate disparate areas of code.


• Usage meaningful variables and method/function/class names.
• Effective documentation.
Sample Code:
private int stk[]; //array name stk of int type and private access
private int top,capacity; //declaring variables of int type private access

/**
* To insert plate into the stack
* @param x value to be inserted
* return-type void
*/

void insert(int x) {
//if stack is full
if(isFull()) {
System.out.println();

System.out.println("=======================================
===================");

System.out.println("=======================================
===================");
System.out.println("It's an Overflow,so we can't put back your
plate back.....");

System.out.println("=======================================
===================");

System.out.println("=======================================
===================");
System.out.println();
return;
}
Department of Computer Science and Engineering, SDMCET, Dharwad. 18
Plate Distribution
//else
stk[++top]=x;
System.out.println("Thank you... You have successfully inserted your
plate");
}

Portability – The written code is portable as it is written in Java. The output of


the Java compiler is bytecode, which leads to the security and portability of the
Java code.

Sample Code:
package com.sdmect.iopp_project;

public abstract class Array {//beginning of the class Array


abstract void setSize(int size); //function call setSize() and
// abstract non-access modifier
abstract boolean isFull(); //function call isFull()
// and abstract non-access
// modifier
abstract boolean isEmpty(); //function call isEmpty() and
// abstract non-access modifier
abstract int peek(); //function call peek() and abstract
// non-access modifier
abstract void insert(int x); //function call insert() and
// abstract non-access modifier
abstract void delete(); //function call delete() and abstract
// non-access modifier
}//end of the class Array

Maintainability – The program written can easily be modified to correct faults,


improve performance or adapt to a changed environment.

Sample Code:
//If we want to add any methods in any class, modifications need not //to be done
in other classes
package com.sdmect.iopp_project;
Department of Computer Science and Engineering, SDMCET, Dharwad. 19
Plate Distribution

/**
* class name: Stack
* functions: isEmpty(),isFull(),peek(),insert(),delete(),peek()
* return-type: boolean,void,int
*
*/

public class Stack extends Array{ //beginning of the class Stack


private int stk[]; //array name stk of int type and
// private access
private int top,capacity; //declaring variables of int type
// private access

/**
* to get the size the Stack
* @return int
* return the size of the stack
*/
void getSize() {
return size;
}
}//end of the class Stack

Testability - The code has been designed and implemented to make it easier for
tests to achieve complete and repeatable code path coverage and simulates all
usage situations in a cost-efficient manner.

Sample Code:
Test Case-3: State->Stack Full
stk.insert(4);
boolean result2 = stk.isFull();
if(result2==true)
{
System.out.println("Test Case 3 is successful, Stack is full");
}
Department of Computer Science and Engineering, SDMCET, Dharwad. 20
Plate Distribution
else
{
System.out.println("Test Case 3 is not successful, Stack is not
full");
}

Adaptability – The code is adaptable and can be changed according to the


changing technology and need.

//If we need any change we can do it in particular classes according to the need
package com.sdmect.iopp_project;

/**
* class name: Queue
* functions: isEmpty(),isFull(),peek(),insert(),delete(),peek()
* return-type: boolean,void,int
*
*/

public class Queue extends Array{ //beginning of the class Queue


private int que[]; //array name que of int type and
// private access
private int top,capacity; //declaring variables of int type
// private access

/**
* to get the size the Queue
* @return int
* return the size of the queue
*/
void getSize() {
return size;
}
}//end of the class Queue

Department of Computer Science and Engineering, SDMCET, Dharwad. 21


Plate Distribution
Cohesiveness and coupling – The written code has low coupling
(interdependency between the modules is low) and high cohesion (functional
relatability of the modules is high).

Coupling: There is no interdependency between classes such as Stack and Queue,


so the written code has zero coupling.

Cohesiveness: There is no direct relationship between functions.


But in main class we are calling methods that are depending on other methods.

Sample Code:
System.out.println("Enter your ID");
studentID=sc.nextInt();
//queue is full
if(studentID==queue1.peek()) { //beginning of if
System.out.println("----------------------------------------------------------");
//Functional dependency
stk1.delete(); //one plate gets removed from the Stack
queue1.delete(); //one students goes out of the Queue
System.out.println("----------------------------------------------------------");
}//end of if

Sufficiency – The written code is sufficient as the component captures those


characteristics that are necessary to permit a meaningful and efficient interaction
with the component.

Completeness – The written code is complete as it has all the necessary and
appropriate parts and meets all the requirement of the project.

Department of Computer Science and Engineering, SDMCET, Dharwad. 22


Plate Distribution

CHAPTER 6: CONCLUSION

This program has been designed in such a way that, it makes the plate
distribution process in hostel messes more organized, systematic and less chaotic.
The program has been written by taking most of the possible cases into
consideration. We have also incorporated all the important features in the
program.

Link to our presentation video -


https://drive.google.com/file/d/1rNCt9XfbmB9CuNbGtX1eP9G5reDLL3jH/view
?usp=drivesdk

Department of Computer Science and Engineering, SDMCET, Dharwad. 23

You might also like