Project2 Quater5

download Project2 Quater5

of 26

Transcript of Project2 Quater5

  • 8/3/2019 Project2 Quater5

    1/26

    PROJECTREPORT11/2011

    STUDENT MANAGEMENTSYSTEM

    Students: Phm c DngNguyn Trung Kin

    Batch Code: SE01

    Centre: NIIT- ANZ

  • 8/3/2019 Project2 Quater5

    2/26

    Project Report NIIT-ANZ

    PROJECT ON

    Page 2 of 26

  • 8/3/2019 Project2 Quater5

    3/26

    Project Report NIIT-ANZ

    Developed by

    Name: Phm c DngNguyn Trung Kin

    STUDENT MANAGEMENT SYSTEM

    Page 3 of 26

  • 8/3/2019 Project2 Quater5

    4/26

    Project Report NIIT-ANZ

    Batch Code : SE01

    Start Date : 25-11-2011 End Date:30-11-2011

    Names of Developers : Phm c Dng, Nguyn Trung Kin

    Date of Submission: 30-11-2011

    Page 4 of 26

  • 8/3/2019 Project2 Quater5

    5/26

    Project Report NIIT-ANZ

    CERTIFICATE

    This is to certify that this report titled Student Management Student. Embodiesthe original work done by Pham Duc Dung, Nguyen Trung Kien in partialfulfillment of their course requirement at NIIT.

    Coordinator:Nguyen Xuan Viet

    Page 5 of 26

  • 8/3/2019 Project2 Quater5

    6/26

    Project Report NIIT-ANZ

    ACKNOWLEDGEMENT

    We have benefited a lot from the feedback and suggestions given by teacher Nguyen

    Xuan Viet and friends in my class.

    Page 6 of 26

  • 8/3/2019 Project2 Quater5

    7/26

    Project Report NIIT-ANZ

    INTRODUCTION

    BACKGROUNDBrilliant Careers was established twenty years ago in New York by Norman Bates

    and is one of the best engineering institutes of the country. When the institute was

    established, it started with two streams, Electronics & Telecommunications and

    Electrical & Electronics. As the technology became advanced and the students

    achieved excellent results, many other streams were also introduced, such as

    Computer Science, Information Technology, and Electronics & Instrumentation.

    This resulted in rapid increase in the number of students getting themselves enrolled

    to various new streams being offered by the institute.Envisioned System

    The institute is planning to computerize the tasks related to its student management.

    You have been asked to implement this new computerized sytem in the institute.

    You need to use shell scripting to create Student Management software as the

    computers

    In the institute run on the Linux operating sytem. The followng task-list has been

    given to you in order to computerize the existing system:

    Create four files, FirstSem, SecondSem, ThirdSem, FourthSem to store theand semested-wise record of all students.

    Whenever a new student joins the institute, open the respective semester file

    and record the following details about the student:

    Student_ID (Generated automatically)

    Frist_Name

    Last_Name

    Stream ID (CS/IT/ET/EE/EI/ME/CE)

    Phone

    State

    Note: The format for all semester files in same.

    The delimiter, colon (:), is used as field separator in all the files.

    Whenever a student leaves the institute, delete his/her from the reapective file.

    Whenever a student details in changed, make appropriate changes in the

    repective student file.

    Implement the following search operations:

    Search any student detail based on the Student_ID

    Search records of the students who live in same city (City wise)

    Search records stream wise and semester wise

    Page 7 of 26

  • 8/3/2019 Project2 Quater5

    8/26

    Project Report NIIT-ANZ

    Search records of the students who live in same State (State wise)

    Generate the following reports for the technical department:

    Stream wise and semester wise report of the student

    Stream wise report of all the students from all semesters

    Page 8 of 26

  • 8/3/2019 Project2 Quater5

    9/26

    Project Report NIIT-ANZ

    ACTIVITIES LIST

    The following tasks have been performed to meet the specifications of the project

    scenario:

    1) Create a script file as main.sh. This file contains the code to display the mainmenu.

    2) Create a script file as add_stu.sh. This file contains the code to add recordsin file created to store the student record.

    3) Create a script file as delete_stu.sh. This file contains the code to deleterecords to store the student record records in file created to store the hostel

    record.

    4) Create a script file as edit.sh. This file contains the code to modify records tostore the student record.

    5) Create a script file as search.sh. This file contains the code to search recordsto store the student record.

    6) Create a script file as report.sh. This file contains the code to view reportinformation student.

    Page 9 of 26

  • 8/3/2019 Project2 Quater5

    10/26

    Project Report NIIT-ANZ

    ARCHITECTURE DIAGAMMAIN.SH

    Page 10 of 26

    student.sh

    hostel1.sh

    print.sh

    report.sh

    user_group

    main.sh

  • 8/3/2019 Project2 Quater5

    11/26

    Project Report NIIT-ANZ

    ARCHITECTURE DIAGAMSTUDENT.SH

    Page 11 of 26

    Edit FirstName

    Edit LastName

    Edit Dateof

    Enrollment

    EditStreamID

    Edit Phone

    Edit City

    Edit State

    Edit ZipCode

    Stream

    City

    State

    ID

    student.sh

    Edit

    Add

    Delete

    Search

  • 8/3/2019 Project2 Quater5

    12/26

    Project Report NIIT-ANZ

    ARCHITECTURE DIAGAM HOSTEL.SH

    Page 12 of 26

    StudentName

    EditFathers

    Name

    Edit RoomNumber

    Edit StreamCode

    Edit SemesterCode

    EditAddress

    EditPhone

    EditCharacter

    Grade

    Edit RoomPartners

    Name

    RoomNumber

    Stream

    hostel.sh

    Edit

    Add

    Delete

    Search

    Semester

    Address

  • 8/3/2019 Project2 Quater5

    13/26

    Project Report NIIT-ANZ

    ARCHITECTURE DIAGAMUSER_GROUP.SH

    Page 13 of 26

    user_group.sh

    Add User

    Add Group

  • 8/3/2019 Project2 Quater5

    14/26

    Project Report NIIT-ANZ

    CODEFORTHEMAIN.SH

    #!/bin/bashtput clear

    opt=0while [ $opt != 6 ]do

    echo "#################STUDENT MANAGEMENT SYSTEM######################"

    echo "# ==============================================================#"

    echo " 1. Add new Student"

    echo " 2. Delete Student"echo " 3. Edit Student"echo " 4. Search Student"echo " 5. Report"echo " 6. Exit"

    echo"==================================================================="

    echo"###################################################################"

    echo -e " Enter Choice: \c"read optcase $opt in

    1) . add_stu.sh;;2) . delete_stu.sh;;3) . edit.sh;;4) . search.sh;;5) . report.sh;;6) exit;;*) echo "Invaid Input"

    echo "Press continue..."read;;

    esacdone

    Page 14 of 26

  • 8/3/2019 Project2 Quater5

    15/26

    Project Report NIIT-ANZ

    CODEFORTHEADD_STU.SH

    clear

    echoecho " ==== STUDENT MANAGEMENT SYSTEM ===="echoecho " Student Information"echo "========================================"st_ID=`cat student.txt | cut -d: -f1|tail -1`echo " Student ID: `expr $st_ID + 1`"l=0echo -n " First Name: "read fname

    while test "$fname" == ""doecho "First name not null"echo "Please re enter: "read fnameif test "$fname" != ""thenbreakfidone

    echo -n " Last Name: "read lname

    while test "$lname" == ""doecho "Last name not null"

    echo "Please re enter: "read lnameif test "$lname" != ""thenbreakfidone

    echo " Date of Enrollment: `date +%d`/`date +%m`/`date +%Y`"date="`date +%d`/`date +%m`/`date +%Y`"echo -n " Stream ID (CS, IT, EE, ET, EI, ME, CE): "read str_ID######bat loi nhap khong dung ID

    n=0for st_ID in CS IT EE ET EI ME CEdoif [ "$st_ID" != "$str_ID" ]thenn=`expr $n + 1`

    fidonewhile test $n = 7do

    echo "**Stream ID is invalid**"echo "**Stream ID is CS, IT, EE, ET, EI, ME, CE.**"echo " Please reenter: "

    read str_IDn=0

    for st_ID in CS IT EE ET EI ME CEdoif [ "$st_ID" != "$str_ID" ]

    Page 15 of 26

  • 8/3/2019 Project2 Quater5

    16/26

    Project Report NIIT-ANZ

    thenn=`expr $n + 1`

    fidoneif [ $n = 6 ]

    then

    breakfidone

    ########echo -n " State: "read state

    while test "$state" == ""doecho "State not null"echo "Please re enter: "read stateif test "$state" != ""then

    breakfidone

    echo -n " City: "read city

    while test "$city" == ""doecho "City not null"echo "Please re enter: "read cityif test "$city" != ""then

    breakfidone

    echo -n " Address: "read add

    while test "$add" == ""doecho "Address not null"echo "Please re enter: "read addif test "$add" != ""thenbreak

    fidone

    echo -n " Contact Number: "read cnumecho "========================================"if test ! -f Students.txt

    thensd_ID=1touch Students.txt

    elsesd_ID=`tail -1 Students.txt | cut -d: -f1`

    sd_ID=`expr $sd_ID + 1`fi

    if [ $l = 0 ]then

    echo $sd_ID:$fname:$lname:$date:$str_ID:$city:$state:$add:$cnum >>

    Page 16 of 26

  • 8/3/2019 Project2 Quater5

    17/26

    Project Report NIIT-ANZ

    Students.txtecho " Join success!"

    echoecho " 1.Add new student."echo " 2.Return main menu."echo " 3.Exit"

    echo -n " Enter your choice: "read chcase $ch in"1") bash add_stu.sh;;"2") bash Main.sh;;"3") exit;;*) echo -e "\n\t Invalid input!\c"echo -e "\n\t\t Press key to continue...\c"read;;esac

    ficlear

    Page 17 of 26

  • 8/3/2019 Project2 Quater5

    18/26

    Project Report NIIT-ANZ

    CODEFORTHE DELETE_STU.SH

    clearechoecho " ==== STRUDENT MANAGEMENT SYSTEM ===="echoecho " Delete Student Information "echo "======================================"echotouch poolfileecho -n " Enter Student ID you want delete: "read sd_IDexist_ID=`cat Students.txt | cut -d: -f1 | grep "$sd_ID"`if [ "$exist_ID" == "" ]

    then echo " Cannot find Student ID!"else

    echo -n " Do you want delete record with student id $sd_ID (Y/N) : "read questcat Students.txt | while read linedo

    pass=`echo "$line" | cut -d: -f1`if [ "$pass" != "$sd_ID" ]then

    echo $line>>poolfileelse

    if [ "$quest" == "N" -o "$quest" == "n" ]

    thenecho $line>>poolfile

    elif [ "$quest" == "Y" -o "$quest" == "y" ]thenbreakfi

    fidonecat poolfile>Students.txtecho "Done"

    firm poolfile

    echo "======================================"echo " Option"bash option

    Page 18 of 26

  • 8/3/2019 Project2 Quater5

    19/26

    Project Report NIIT-ANZ

    CODEFORTHE SEARCH.SH

    #!/bin/bash

    tput cleartimkiem(){opt=0while [ $opt != 6 ]do

    echo "#######################SEARCHSTUDENT#############################"

    echo "# ==============================================================#"

    echo " 1. Search Student ID"echo " 2. Search Stream ID"echo " 3. Search City"echo " 4. Search State"echo " 5. Back Menu Main"echo " 6. Exit"

    echo"==================================================================="

    echo"###################################################################"

    echo -e " Enter Choice: \c"read optcase $opt in

    1) search_student;;

    2) search_stream;;3) search_city;;4) search_state;;5) . main.sh;;6) exit;;*) echo "Invaid Input"echo "Press continue..."read;;

    esacdone}

    search_student(){echo -e "Please enter your student ID in the database : \c"

    read IDSuaTimThay=`cat Students.txt |cut -d: -f1|grep "^$IDSua"`if [ "$IDSua" != "$TimThay" ]then

    echo "student ID you entered is not in the database". search.sh

    elsekq1=`cat Students.txt |grep "^$TimThay"`echo "Enter your student ID found: $TimThay"echo "Student ID:First name:Last name:Date of Enrollment:Stream

    ID:City:State:Address:Contact Number(Phone)"echo "$kq1"exit

    fi}

    Page 19 of 26

  • 8/3/2019 Project2 Quater5

    20/26

    Project Report NIIT-ANZ

    search_stream(){

    echo "========================================"echo "Stream ID only allowed to enter values: "

    echo "CS: Computer Science"

    echo "IT: Information Technology"echo "ET: Electronics & Telecommunications"echo "EE: Electrical & Electronics"echo "EI: Electronics & Instrumentation"echo "ME: Mechanical"echo "CE: Civil Engineering"

    echo "========================================"echo -e "Enter Stream ID new: \c"read streamewhile test "$streame" != "CS" -a "$streame" != "IT" -a "$streame" !=

    "ET" -a "$streame" != "EE" -a "$streame" != "EI" -a "$streame" != "ME" -a"$streame" != "CE"

    do

    echo "The value entered is not valid, the above test conditions!"echo -e "Please re-enter your StreameID: \c"read streame

    doneecho -e "Please enter your Stream ID in the database : \c"

    TimThay=`cat Students.txt |cut -d: -f5|grep "^$streame"`streamIDcu=`cat Students.txt |grep "^$TimThay"`while test "$TimThay" == ""do

    echo "Stream ID you entered is not in the database"echo -e "Please re-enter your Student ID:"read streame

    TimThay=`cat Students.txt | cut -d: -f5 | grep "$streame"`if test "$TimThay" != ""then

    breakfi

    doneecho "Enter your student ID found: $TimThay"echo "Student ID:First name:Last name:Date of Enrollment:Stream

    ID:City:State:Address:Contact Number(Phone)"echo "$streamIDcu"

    }search_city()

    {echo -e "Please enter your City in the database : \c"

    read cityTimThay=`cat Students.txt |cut -d: -f7|grep "^$city"`if [ "$city" != "$TimThay" ]then

    echo "City you entered is not in the database". search.sh

    elsefname=`cat Students.txt |grep "^$city"|cut -d: -f2|head -1`lname=`cat Students.txt |grep "^$city"|cut -d: -f3|head -1`kq=`cat Students.txt |grep "^$city"|cut -d: -f7|head -1`

    echo "Enter your Stream ID found: $TimThay"echo "First name:Last name:City"echo "$fname:$flname:$kq"exit

    fi

    Page 20 of 26

  • 8/3/2019 Project2 Quater5

    21/26

    Project Report NIIT-ANZ

    }

    search_state(){

    echo -e "Please enter your State in the database : \c"read IDSua

    TimThay=`cat Students.txt |cut -d: -f6|grep "^$IDSua"`if [ "$IDSua" != "$TimThay" ]then

    echo "State you entered is not in the database". search.sh

    elsekq=`cat Students.txt |grep "^$TimThay"`echo "Enter your Stream ID found: $TimThay"echo "Student ID:First name:Last name:Date of Enrollment:Stream

    ID:City:State:Address:Contact Number(Phone)"echo "$kq"exit

    fi

    }timkiem

    Page 21 of 26

  • 8/3/2019 Project2 Quater5

    22/26

    Project Report NIIT-ANZ

    CODEFORTHEREPORT.SH

    report(){echoecho -e " Moi nhap vao ID cua sinh vien: \c"read idthongtin=`grep ^$id danhsachsv.txt`echo $thongtin>filetam2

    fname=`cut -d: -f2 filetam2`lname=`cut -d: -f3 filetam2`date=`cut -d: -f4 filetam2`

    stream=`cut -d: -f5 filetam2`phone=`cut -d: -f6 filetam2`city=`cut -d: -f7 filetam2`

    echoecho " STUDENT INFORMATION"echoecho " StudentID: "$idecho " First Name: "$fnameecho " Last Name: "$lnameecho " Date of Enrollment: "$dateecho " StreamID: "$streamecho " Phone: "$phone

    echo " Address: "$cityread}report

    Page 22 of 26

  • 8/3/2019 Project2 Quater5

    23/26

    Project Report NIIT-ANZ

    CODEFORTHEPRINT.SH

    Page 23 of 26

  • 8/3/2019 Project2 Quater5

    24/26

    Project Report NIIT-ANZ

    EXECUTETHE APPLICATION

    To execute the Sutudent Management System shell script application:

    1. Log on as root user.

    2. Create a directory, project, under your home directory, and copy all the

    Student Managament System related shell Script to the directory, project.

    3. Issue the following command to change the permission of the shell scripts

    such that the user ha execute permission on them:

    chmod 774 ~/project/*.sh

    4. Log out and log on again as the root user.

    5. Issue the following command at the shell prompt to execute the Student

    Management System shell script application:

    . main.sh

    Page 24 of 26

  • 8/3/2019 Project2 Quater5

    25/26

    Project Report NIIT-ANZ

    SYSTEM CONFIGURATION

    Hardware: PC compatible with a Intel Atom processor, 256-MB RAM, and 20GBof Hard disk.

    Operating system: Fedore Core 6 opetaring system

    Page 25 of 26

  • 8/3/2019 Project2 Quater5

    26/26

    Project Report NIIT-ANZ

    PROJECT FILE DETAILS

    S.No File Name Description

    1 main.sh Contains the code to display the main menu.

    2 create.shContains the code to add records in file created to

    store the student record.

    3 delete.shContains the code to delete records in file created

    to store the hostel record.

    4 edit.shContains the code to modify records in file created

    to store the hostel record.

    5 search.shContains the code to search records in file createdto store the hostel record.

    6 report.shContains the code to view reportinformation student.