Shri Dharmasthala Manjunatheshwara College of Engineering & Technology
Shri Dharmasthala Manjunatheshwara College of Engineering & Technology
REPORT
ON
“PLATE DISTRIBUTION SYSTEM”
Submitted by
USN Name
Page 1 of 43
Plate Distribution
Table of Contents
PROBLEM STATEMENT.....................................................................................3
CHAPTER 1: INTRODUCTION...........................................................................4
CHAPTER 2: DETAILED DESIGN......................................................................5
CHAPTER 3: PROJECT SPECIFIC REQUIREMENTS......................................7
CHAPTER 4: IMPLEMENTATION.....................................................................8
CHAPTER 5: RESULTS......................................................................................32
CHAPTER 6: OUTCOMES…………...………………….…………………….35
CHAPTER 7: CONCLUSION.............................................................................41
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.
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.
State Diagrams
Class Diagram
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
CHAPTER 4: IMPLEMENTATION
Implementation is the stage where the theoretical design is turned into a working
system.
Design Specification:
Java Code
Ar package com.sdmect.iopp_project;
abstract void setSize(int size); //function call setSize() and abstract non-access
modifier
abstract void insert(int x); //function call insert() and abstract non-
access modifier
Stack.java
/*
package com.sdmect.iopp_project;
/**
* functions: isEmpty(),isFull(),peek(),insert(),delete(),peek()
* return-type: boolean,void,int
*/
private int stk[]; //array name stk of int type and private access
/**
*/
stk=new int[size];
top=-1;
/**
* return-type boolean
*/
boolean isFull() {
return top==capacity-1;
/**
* return-type boolean
*/
boolean isEmpty() {
return top==-1;
/**
* @return 0 if stack is empty else returns top element;value will be always non
negative
*/
int peek() {
if(isEmpty()) {
return 0;
return stk[top];
/**
* return-type void
*/
void insert(int x) {
if(isFull()) {
System.out.println();
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println();
return;
//else
stk[++top]=x;
/**
* return-type void
*/
void delete(){
Department of Computer Science and Engineering, SDMCET, Dharwad. 16
Plate Distribution
//if stack is empty
if(isEmpty()) {
System.out.println();
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println();
return;
//else
int y=stk[top--];
Queue.java
/*
*/
package com.sdmect.iopp_project;
/*
* class name:Queue
* functions:isFull,isEmpty(),insert(),delete(),peek()
* return-type:boolean,void,int
*/
public class Queue extends Array{ //class Queue inherits properties of class Array
private int queue[]; //array name queue of int type and private access
private int front,rear; // declaring front, rear of int type and private access
private int capacity,count; //declaring capacity, count of int type and private
access
/**
*/
capacity=size;
front=0;
rear=-1;
/**
* return-type boolean
*/
boolean isFull() {
return count==capacity;
/**
*/
boolean isEmpty() {
return count==0;
/**
* return-type void
*/
void insert(int x) {
if(isFull()) {
System.out.println();
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println();
return;
//else
rear=(rear+1)%capacity;
queue[rear]=x;
count++;
/**
* return-type void
*/
void delete() {
if(isEmpty()) {
Department of Computer Science and Engineering, SDMCET, Dharwad. 21
Plate Distribution
System.out.println();
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println("=====================================================
=====");
System.out.println();
return;
//else
front=(front+1)%capacity;
count--;
/**
*/
int peek() {
if(isEmpty()) {
return 0;
return queue[front];
Main.java
package com.sdmect.iopp_project;
import java.util.Scanner;
/*
* class name:Main
*/
/**
int studentID;
System.out.println("Good Morning!!!!!!");
System.out.println("----------------------------------------------------------");
int n=sc.nextInt();
stk1.setSize(n);
queue1.setSize(n);
System.out.println("----------------------------------------------------------");
for(;;) {
int choice=sc.nextInt();
if(choice==1) {
Department of Computer Science and Engineering, SDMCET, Dharwad. 24
Plate Distribution
System.out.println("Enter your choice:");
System.out.println("3.EXIT.................");
int selection=sc.nextInt();
System.out.println("----------------------------------------------------------");
switch(selection) {
case 1:
studentID=sc.nextInt();
System.out.println("----------------------------------------------------------");
System.out.println("----------------------------------------------------------");
break;
case 2:
studentID=sc.nextInt();
//queue is full
if(studentID==queue1.peek()) {
System.out.println("----------------------------------------------------------");
System.out.println("----------------------------------------------------------");
//queue is empty
else if(queue1.peek()==0) {
System.out.println("----------------------------------------------------------");
System.out.println("----------------------------------------------------------");
else {
System.out.println("----------------------------------------------------------");
System.out.println("----------------------------------------------------------");
break;
case 3:
System.exit(0);
default:
System.out.println("Invalid choice");
System.exit(0);
else if(choice==2) {
System.out.println("----------------------------------------------------------");
int totalNoOfPlates=sc.nextInt();
for(int i=1;i<=totalNoOfPlates;i++) {
System.out.println("----------------------------------------------------------");
System.out.println("----------------------------------------------------------");
//invalid choice
else {
System.out.println("Invalid Choice");
System.exit(0);
Department of Computer Science and Engineering, SDMCET, Dharwad. 27
Plate Distribution
}
Test Cases
StackTest
class StackTest {
void test() {
Stack stk = new Stack();
stk.setSize(3);
CHAPTER 5: RESULTS
When the number of plates the staff is putting back is greater than the number of students:
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:
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.
/**
* 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. 38
Plate Distribution
}
//else
stk[++top]=x;
System.out.println("Thank you... You have successfully inserted your
plate");
}
Sample Code:
package com.sdmect.iopp_project;
Sample Code:
//If we want to add any methods in any class, modifications need not //to be done
in other classes
Department of Computer Science and Engineering, SDMCET, Dharwad. 39
Plate Distribution
package com.sdmect.iopp_project;
/**
* class name: Stack
* functions: isEmpty(),isFull(),peek(),insert(),delete(),peek()
* return-type: boolean,void,int
*
*/
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");
//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
*
*/
/**
* to get the size the Queue
* @return int
* return the size of the queue
*/
void getSize() {
return size;
}
}//end of the class Queue
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
Completeness – The written code is complete as it has all the necessary and
appropriate parts and meets all the requirement of the project.
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.