You are on page 1of 23

EMAIL ADMINISTRATION

USING FILES AS DATABASE


Project report submitted at the end of third semester

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING

By
P.REVANTH Y.AKASH RAJ S.ABHISHEK
(Regd No: 19981A05D4) (Regd No: 19981A05H8) (Regd No: 19981A05F1)
M. SAI MANISH VARMA
(Regd No: 20985A0524)

Under the esteemed guidance


of

Mr.Ch.Chakradhara Rao,

Assistant or Associate Professor

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


RAGHU ENGINEERING COLLEGE
(Autonomous)
Accredited by NAAC and NBA, Affiliated to JNTU-Kakinada
Dakamarri (V), Bheemunipatnam (M),
Visakhapatnam – 531162
2021

1
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
RAGHU ENGINEERING COLLEGE
(Autonomous)
Accredited by NAAC and NBA, Affiliated to JNTU-Kakinada
Dakamarri (V), Bheemunipatnam (M),
Visakhapatnam

CERTIFICATE
This is to certify that this project entitled "EMAIL ADMINISTRATION USING FILES AS

DATABASE" done by P.REVANTH,Y.AKASH RAJ,S.ABHISHEK,M.SAI MANISH

VARMA.bearing Regd.No: 19981A05D4,19981A05H8,19981A05F1,20985A0524 during the

academic year 2020-2021 in partial fulfillment of the requirements for the completion of fourth

semester of Bachelor of Technology in Computer Science and Engineering,under the

supervision of Mr.Ch.Chakradara Rao,M.Tech,CSE..

Internal Guide Head Of The Department


Mr. Ch.Chakradhara Rao, Dr. S.Srinadha raju,
Department of CSE, Department of CSE,
Raghu Engineering College. Raghu Engineering College.

EXTERNAL EXAMINER

2
DECLARATION

This is to certify that this project titled “EMAIL ADMINISTRATION USING FILES

AS DATABASE” is bonafide work done by us, in partial fulfilment of the requirements for

the completion of fourth semester of the degree B.Tech and submitted to the Department of

Computer Science & Engineering, Raghu Engineering College, Dakkamarri.

We also declare that this project is a result of our own effort and that has not been

copied from anyone and we have taken only citations from the sources which are mentioned

in the references.

P.REVANTH Y.AKASH RAJ

19981A05D4 19981A05H8

S.ABHISHEK M.SAI MANISH VARMA.

19981A05F1 20985A0524

PLACE: REC, Visakhapatnam DATE:

3
TABLE OF CONTENTS

S.NO CONTENT PAGE NUMBER

1 Project statement 6

2 Project description 7

3 Concepts used 8-12

4 Source code 13-20

5 Screen shots 21-22

6 References 23

4
EMAIL
ADMINISTRATION
USING FILES
AS
DATABASE

5
STATEMENT

This project is about building an Email administration application


using files as database.

6
DESCRIPTION

This project is a basic Java project focused on applying object


oriented design in a real world application.

Email administration by using files as a database is to simulate the


existing email system. Its purpose is to send and receive electronic
mails (e-mails). This project is developed using JAVA and files
concepts in java.

7
CONCEPTS USED

1. Switch case:

The switch statement is a multi-way branch statement. It provides an


easy way to dispatch execution to different parts of code based on the
value of the expression.Basically, the expression can be byte, short,
char, and int primitive data types.Duplicate case values are not
allowed.The value for a case must be of the same data type as the
variable in the switch.The value for a case must be a constant or a
literal. Variables are not allowed. The break statement is used inside
the switch to terminate a statementsequence. The break statement is
optional. If omitted, execution will continue on into

the next case.The default statement is optional and can appear


anywhere inside the switchblock. In case, if it is not at the end, then a
break statement must be kept after the default statement to omit the
execution of the next case statement.

2.Conditional statements (if,else if,else)

If / Else / Else If conditional statements are conditional statements that


have more than one condition. If the first condition is false, only then
will the second condition will be checked. If the second one is also
false, then default to else or it will do nothing

8
3.Loops (for, while,do while)

While Loop :

A while loop is the most straightforward looping structure. While loop

syntax in C programming language is as follows:

Syntax of While Loop:

while (condition) {

statements;

It is an entry-controlled loop. In while loop, a condition is evaluated


before processing a body of the loop. If a condition is true then and only
then the body of a loop is executed. After the body of a loop is executed
then control again goes back at the beginning, and the condition is
checked if it is true, the same process is executed until the condition
becomes false. Once the condition becomes false, the control goes out
of the loop.

Do-While loop

A do...while loop in C is similar to the while loop except that the


condition is always executed after the body of a loop. It is also called
an exit-controlled loop.

Syntax of do while loop in C programming language is as follows:

9
Syntax of Do-While Loop:

do {

statements

} while (expression);

For loop:

A for loop is a more efficient loop structure in 'C' programming. The


general

structure of for loop syntax in C is as follows:

Syntax of For Loop :

for (initial value; condition; incrementation or decrementation )

statements;

equals method in java:

In Java, string equals() method compares the two given strings based
on the data/content of the string. If all the contents of both the strings
are same then it returns true. If all characters are not matched then it
returns false.

Classes:

10
A class is a user defined blueprint or prototype from which objects are
created. It represents the set of properties or methods that are common
to all objects of one type. In general, class declarations can include
these components,in order:

Modifiers: A class can be public or has default access (Refer this for
details).

class keyword: class keyword is used to create a class.

Class name: The name should begin with an initial letter (capitalized
by convention). Superclass(if any): The name of the class’s parent
(superclass), if any,preceded by the keyword extends. A class can only
extend (subclass) one parent.

Interfaces(if any): A comma-separated list of interfaces implemented


by the class, if any, preceded by the keyword implements. A class can
implement more than one interface.

Body: The class body surrounded by braces, { }.

5. JAVA PACKAGES

A java package is a group of similar types of classes, interfaces and


sub-packages. Package in java can be categorized in two form, built-in
package and user-defined package. There are many built-in packages
such as java, lang, awt, javax, swing, net, io, util,

sql etc.Here, we will have the detailed learning of creating and using
user-defined packages.

11
6. Java File Class

The File class is an abstract representation of file and directory path


name. A path name can be either absolute or relative.

The File class have several methods for working with directories and
files such as creating new directories or files, deleting and renaming
directories or files, listing the contents of a directory etc.

It is an abstract representation of file and directory path names.

A path name, whether abstract or in string form can be either absolute


or relative. The parent of an abstract path name may be obtained by
invoking the getParent() method of this class.

First of all, we should create the File class object by passing the
filename or directory name to it. A file system may implement
restrictions to certain operations on the actual file-system object, such
as reading, writing, and executing. These restrictions are collectively
known as access permissions.Instances of the File class are immutable;
that is, once created, the abstractpathname represented by a File object
will never change.

12
SOURCE CODE

import java.io.*;

import java.lang.*;

import java.util.*;

public class Email

public static void main(String args[])throws IOException

InputStreamReader I=new InputStreamReader(System.in);

BufferedReader B=new BufferedReader(I);

System.out.print("\n Enter function (SignUp, Login, Compose): ");

String ch=B.readLine();

if(ch.equals("signup"))

InputStreamReader reader=new InputStreamReader(System.in);

BufferedReader input=new BufferedReader(reader);

13
System.out.print(" Username@gmail.com: ");

java.lang.String User=input.readLine();

System.out.print(" Password: ");

java.lang.String Pass=input.readLine();

System.out.println(" New ID created successfully!");

FileWriter fout=new FileWriter(User+"@gmail.com");

BufferedWriter bout=new BufferedWriter(fout);

PrintWriter pout=new PrintWriter(bout);

pout.println(Pass);

FileWriter fot=new FileWriter(User);

BufferedWriter bot=new BufferedWriter(fot);

PrintWriter pot=new PrintWriter(bot);

pout.close();

bout.close();

pout.close();

14
}

else

if(ch.equals("login"))

InputStreamReader reader=new InputStreamReader(System.in);

BufferedReader input=new BufferedReader(reader);

System.out.print(" Username: ");

java.lang.String User=input.readLine();

System.out.print(" Password: ");

java.lang.String Pass=input.readLine();

FileReader fout=new FileReader(User+"@gmail.com");

BufferedReader bout=new BufferedReader(fout);

java.lang.String data=bout.readLine();

if(Pass.equals(data))

System.out.println(" Logged On!");

15
System.out.print(" Do you want to go to the inbox: (yes/no)");

java.lang.String Ask=input.readLine();

if(Ask.equals("yes"))

FileReader f=new FileReader(User);

BufferedReader b=new BufferedReader(f);

System.out.println("");

java.lang.String Composed;

int i=0;

while((Composed=b.readLine())!=null)

i++;

System.out.println(Composed);

System.out.println("");

b.close();

bout.close();

16
}

else

System.out.println(" Wrong password!");

else

if(ch.equals("compose"))

InputStreamReader reader=new InputStreamReader(System.in);

BufferedReader input=new BufferedReader(reader);

Calendar c=Calendar.getInstance();

System.out.print(" Username: ");

java.lang.String User1=input.readLine();

System.out.print(" Password: ");

17
java.lang.String Pass=input.readLine();

FileReader fout=new FileReader(User1+"@gmail.com");

BufferedReader bout=new BufferedReader(fout);

java.lang.String data=bout.readLine();

if(Pass.equals(data))

System.out.println(" Logged On!");

System.out.print(" To: ");

java.lang.String User=input.readLine();

System.out.print(" From: ");

java.lang.String From=input.readLine();

System.out.println("");

System.out.println(" Letter Content:");

java.lang.String Body=input.readLine();

18
FileWriter fin=new FileWriter(User);

BufferedWriter bin=new BufferedWriter(fin);

PrintWriter pin=new PrintWriter(bin);

System.out.println("");

pin.println("
Time:"+c.get(Calendar.HOUR)+":"+c.get(Calendar.MINUTE)+"
PM");

pin.println(" From "+From+",");

pin.println(Body);

System.out.println("");

System.out.println(" Mail sent!");

bout.close();

pin.close();

bin.close();

pin.close();

else

System.out.println(" Wrong password!");

19
}

else

System.out.println(" Wrong choice!");

20
1. SCREEN SHOTS

21
22
REFERENCES

● www.geekforgeeks.com
● www.projectgeek.com
● https//www.javapoint.com
● https//www.w3schools.com

23

You might also like