You are on page 1of 26

PROJECT BASED LAB REPORT

On
CROP MANAGEMENT SYSTEM IN MANDAL
Submitted in partial fulfilment of the
Requirements for the award of the Degree of

Bachelor of Technology
in
COMPUTER SCIENCE ENGINEERING

By
K.Kalyani (150040360)
P.Tarun (150040701)

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

K L University
Green Fields, Vaddeswaram, Guntur District-522 502
2016-2017
K L University
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CERTIFICAT
E
This is to certify that this project based lab report entitled “Crop management system in

mandal” is a bonafide work done by k.kalyani (150040360), P.Tarun (150040701) in partial


fulfilment of the requirements for the award of degree in BACHELOR OF TECHNOLOGY in
ELECTRONICS AND COMMUNICATION ENGINEERING during the Academic year
2016-2017.

Faculty in Charge Head of the Department


Smt. P.S.G.Aruna Sri. Dr.V.SRIKANTH

Project guide
 Dr.K. Ravindranath.
K L University
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
DECLARATIO
N

We hereby declare that this project based lab report titled “Crop management system in

mandal” has been prepared by us in partial fulfilment of the requirements for the award of
degree “BACHELOR OF TECHNOLOGY in COMPUTER SCIENCE ENGNEERING”
during the Academic year 2016-2017.

We also declare that this project based lab report is of our own efforts and it has not been
submitted to any other university for the award of any degree.

K.Kalyani (150040360)
P.Tarun (150040701)

ACKNOWLEDGEMENT

Our sincere thanks to  Smt P.S.G.Aruna Sri in the Lab for their outstanding support through
out the project for the successful completion of the work.
We express our gratitude to DR.V. SRIKANTH, Head of the Department for Computer science
and Engineering for providing us with adequate facilities, ways and means by which we are able
to complete this project based Lab.

We would like to place on record the deep sense of gratitude to the honourable Vice Chancellor,
K L University for providing the necessary facilities to carry the project based Lab.

Last, but not the least, we thank all Teaching and Non-Teaching Staff of our department and
especially my classmates and my friends for their support in the completion of our project based
Lab.

K.Kalyani (150040360)

P.Tarun (150040701)

CONTENTS

S.NO CONTENTS

1. ABSTRACT
2. INTRODUCTION

3. FUNCTIONAL REQUIREMENTS

4. NON-FUNCTIONAL REQUIREMENTS

5. SOURCE CODE

6. OUTPUT
ABSTRACT
The Java project for a Crop Management System can be performed by considering various
modules. This project deals with the different kinds of crops that are grown in different seasons
in a year. We will use different parameters like name of the crop, water quantity required, type of
soil used, time taken for the crop to grow, income we get from the crop, temperature differences
etc. The concepts of java used in this project are Files, Interfaces, Switch statements etc.

1
INTRODUCTION

A Crop management system (CMS) is an element of crop informatics that focuses mainly on


the administrational needs of crops. In many implementations, a CMS is a comprehensive, integ-
rated information system designed to manage all the aspects of a crops, such as soil content, fer-
tilizers and the corresponding processing of services.

One of the most important issues is crop management system. Crops provide a food to people.

In this project we discuss on the crops and its fertilizers used deping on the season .

Crop management system provide a common source of information about crops. The system
have to keep data in secure place and controls who can reach the data in certain circumstances.
These system provides the information useful for the people for developing our country.The HIS
may control organizations, which is Hospital in these case, official documentations, financial
situation reports, personal data, utilities and stock amounts, also keeps in secure place patients
information, patients medical history, prescriptions, operations and laboratory test results.

The HIS may protect organizations, handwriting error, overstock problems, conflict of schedul-
ing personnel, official documentation errors like tax preparations errors.

2
DESCRIPTION

The project is done based on java programming. This is through object oriented
programming. This gives some necessary information about crops and about its
fertilizers and water necessary for its growth .When we want to search any
information regarding crops it is very difficult to find the right place to go for . we
can get all the information of any crops immediately and accurately. Here almost
all work is computerized. So the accuracy is maintained. Maintaining backup is
very easy .some of the issues can be solved easily by using this project.
The project city crop management system deals with the information of
every state which includes its water content, pesticides. It stores all the data and
details of crops this objective is difficult using the manual system as the
information as necessary information cannot be available. It can be used in
society in various systems.

3
FUNCTIONAL REQUIREMENTS

1 CROP information
To search for the crops based on Here we will be creating the list of details of crops
seasons showing Name of season, crops in that season etc.
Displays all crop details and This is used maintain the details of the crops and the
fertilizers fertilizers for the use
To search crops in the season This is used to search a particular crop details when user
gives a particular search number of that season.
To generate details Here in generating reports we will be able to display all
the details of records of crops with details in the form of
files.
2 Main Module
To display System After all modules were integrated through files we display
the complete information.
To process menu Here Processing Menu can be done through switch cases
with all the modules that are present in the file.
Initializations Here Initializations can be done to methods, variables as
well as objects which are present in classes
To access To provide easy access we informed every thing to user
which will able to access his details . we can be able to
read the file and record of that file, and write that file
where he can be able to do modifications for files that are
present ..
Purpose 
  The purpose of doing this project is to provide all the requirements for the Crop Management
System. The user can search easily anything regarding the crops he want with moving here and
there .This will make his time manageable and there will no waste of time in goingout.

  
  

NON-FUNCTIONAL REQUIREMENTS
INTERFACE:

An interface is a reference type in Java. It is similar to class. It is a collection of abstract


methods. A class implements an interface, thereby inheriting the abstract methods of
the interface. Along with abstract methods, an interface may also contain constants, default
methods, static methods, and nested types.

INHERITANCE :
Inheritance in java is a mechanism in which one object acquires all the properties and
behaviors of parent object. The idea behind inheritance in java is that you can create new
classes that are built upon existing classes.
ABSTRACT CLASS:
A class that is declared with abstract keyword, is known as abstract class in java. It can have ab -
stract and non-abstract methods (method with body).Abstraction is a process of hiding the imple-
mentation details and showing only functionality to the user. Another way, it shows only impor-
tant things to the user and hides the internal details for example sending sms, you just type the
text and send the message. You don't know the internal processing about the message delivery.
ABSTRACT METHOD:
An abstract method is a method that is declared, but contains no implementation. Ab-
stract classes may not be instantiated, and require subclasses to provide implementations for
the abstract methods. Let's look at an example of an abstract class, and an abstract method.
SWITCH STATEMENT:
In Java switch statement is used to execute one code from multiple expressions. It is just like else
if statement. But it is convenient than if..else..if because it can be used with numbers, characters
etc.

5
APPEND:
The append() method is used to insert specified content as the last child (at the end of) the selec-
ted elements in the collection.

The append () and appendTo () methods are used to perform the same task. The only difference
between them is in the syntax.

FILES:
In the Java programming language, The java.io package contains nearly every class you might
ever need to perform input and output (I/O) in Java. All these streams represent an input source
and an output destination. The stream in the java.io package supports many data such as primi-
tives, object, localized characters, etc.
METHOD OVERRIDING:
In object oriented programming, is a language feature that allows a subclass or child class to pro-
vide a specific implementation of a method that is already provided by one of its super classes or
parent classes.
ARRAYS
Java provides a data structure, the array, which stores a fixed-size sequential collection of ele-
ments of the same type. An array is used to store a collection of data, but it is often more useful
to think of an array as a collection of variables of the same type
EXCEPTION HANDLING:
An exception (or exceptional event) is a problem that arises during the execution of a program.
When an Exception occurs the normal flow of the program is disrupted and the program/Appli-
cation terminates abnormally, which is not recommended, therefore, these exceptions are to
be handled.

6
CODE:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class CROPIS {

public static void main(String[] args) {


Scanner scan=new Scanner(System.in);
int choice;
int inchoice;
do
{
System.out.print("----------------CROP MANGEMENT
SYSTEM-----------------\n1.Summer season\n2.Rainy season\n3.Winter season\
n4.Exit\nEnter your choice:");
choice=scan.nextInt();
switch(choice)
{
case 1:
{
7
do
{
System.out.print("---------------Summer Season----------------\
n1.View crops\n2.Add new crop\n3.Delete crop\n4.Exit to main menu\nEnter your
choice:");
inchoice=scan.nextInt();
switch(inchoice)
{
case 1:
Managingfiles.reader("summer");
break;
case 2:
{
System.out.print("Enter the name of the crop you want to
enter:");
String temp=scan.next();
boolean tcheak=Managingfiles.search("summer",temp);
if(tcheak==false)
Managingfiles.writer("summer",temp);
Managingfiles.writer(temp,"");
}
break;
case 3:
System.out.println("Enter the name of the file to
delete:");

8
String temp =scan.next();
Managingfiles.delete("summer",temp);
break;
}
}
while(inchoice>0&&inchoice<4);
}
break;
case 2:
{
do
{
System.out.print("---------------Rainy Season----------------\
n1.View crops\n2.Add new crop\n3.Delete crop\n4.Exit to main menu\nEnter your
choice:");
inchoice=scan.nextInt();
switch(inchoice)
{
case 1:
Managingfiles.reader("rainy");
break;
case 2:
{
System.out.print("Enter the name of the crop you want to
enter:");
String temp=scan.next();

9
boolean tcheak=Managingfiles.search("rainy",temp);
if(tcheak==false)
Managingfiles.writer("rainy",temp);
Managingfiles.writer(temp,"");

}
break;
case 3:
System.out.println("Enter the name of the file to
delete:");
String temp =scan.next();
Managingfiles.delete("rainy",temp);
break;
}
}
while(inchoice>0&&inchoice<4);
}
break;
case 3:
{
do
{
System.out.print("---------------Winter Season----------------\
n1.View crops\n2.Add new crop\n3.Delete crop\n4.Exit to main menu\nEnter your
choice:");

10
inchoice=scan.nextInt();
switch(inchoice)
{
case 1:
Managingfiles.reader("winter");
break;
case 2:
{

System.out.print("Enter the name of the crop you want to


enter:");
String temp=scan.next();
boolean tcheak=Managingfiles.search("winter",temp);
if(tcheak==false)
Managingfiles.writer("winter",temp);
Managingfiles.writer(temp,"");
}
break;
case 3:
System.out.println("Enter the name of the file to
delete:");
String temp =scan.next();
Managingfiles.delete("winter",temp);
break;
}

11

}
while(inchoice>0&&inchoice<4);
}
break;
}
}
while(choice>0&&choice<4);
}
}

class Managingfiles
{

public static void writer(String filename,String cropname)


{
Scanner scan=new Scanner(System.in);
File file=new File((filename+".txt"));
boolean isappend;
try
{
if(!file.exists())
file.createNewFile();
if(filename.equals("summer")||filename.equals("winter")||
filename.equals("rainy"))

12
{
isappend=true;
}
else
{
System.out.println("Do you want to append the existing file (true
or false):");
isappend=scan.nextBoolean();
}
FileWriter fw=new FileWriter(file,isappend);
BufferedWriter bw=new BufferedWriter(fw);
if(filename.equals("summer")||filename.equals("winter")||
filename.equals("rainy"))
{
bw.write(cropname);
bw.write("\n");
}
else
{
String tempstore;
System.out.println("please enter the data and type \"ENDit\" in
new line to finish editing " + filename+ "file:");
do {
tempstore = scan.nextLine();
if (!tempstore.equals("ENDit")) {
bw.write(tempstore);
bw.write("\n");

13
}
} while (!tempstore.equals("ENDit"));
}
bw.close();
fw.close();
}
catch(IOException e)
{
System.out.println(e);
}
}
public static void reader(String filename)
{
Scanner scan=new Scanner(System.in);
try {
int c;
FileReader fr = new FileReader((filename + ".txt"));
BufferedReader br = new BufferedReader(fr);
String tempstore;
System.out.println("-------------------------------------------------" +
filename+ "-------------------------------------------------");
if(filename.equals("summer")||filename.equals("winter")||
filename.equals("rainy"))
{
c = 1;

14
while ((tempstore = br.readLine()) != null)
{
System.out.println(c + "." + tempstore);
c = c + 1;
}
if(c==1)
System.out.println("There are no crops!");
else
{
System.out.print("please enter the name of the
crop:");
Managingfiles.reader(scan.nextLine());
}
}
else
{
while ((tempstore = br.readLine()) != null)
{
System.out.println(tempstore);
}
}
System.out.println(
"-------------------------------------------------------------
---------------------------------------------");
br.close();
fr.close();
}

15
catch (IOException e) {
System.out.println(e);
}
}
public static boolean search(String filename,String cropname)
{
File file = new File((filename+".txt"));
boolean returningval=false;
try
{
if (!file.exists())
file.createNewFile();
FileReader fr = new FileReader((filename+".txt"));
BufferedReader br = new BufferedReader(fr);
String tempstore;
while ((tempstore = br.readLine()) != null)
{
if (tempstore.equals(cropname))
returningval=true;
}

br.close();
}
catch (IOException e)
{
System.out.println(e);
}

16
return returningval;
}
public static void delete(String filename,String cropname)
{
ArrayList<String> listitems=new ArrayList<String>(100);
int count=0;
File dfile = new File((cropname + ".txt"));
if (dfile.delete())
{
try
{
FileReader fr = new FileReader((filename+".txt"));
BufferedReader br = new BufferedReader(fr);
String tempstore;
while ((tempstore = br.readLine()) != null)
{
listitems.add(tempstore);
count++;
}
br.close();
fr.close();
listitems.remove(listitems.indexOf(cropname));
File file=new File((filename+".txt"));

FileWriter fw=new FileWriter(file);


BufferedWriter bw=new BufferedWriter(fw);
for(int i=0;i<count-1;i++)

17
{
bw.write(listitems.get(i));
bw.write("\n");
}
bw.close();
fw.close();
System.out.println(dfile.getName() + " file is deleted");

}
catch(IOException e)
{
System.out.println(e);
}
}
else
System.out.println("Delete operation failed!");
}
}

18

OUTPUT:
SCREEN SHOTS:
19

Conclusion and Future Scope

Conclusion:
The project is successfully completed to the extent possible. The results of the project are shown
earlier.

Future Scope:

Some more functions or modules may be added to project. After studying and understanding
Graphic User Interface (GUI) of java, the inputs and outputs can be improved and implemented
using GUI.

20

You might also like