Professional Java Assignment Help

Top Grade Assignments Help is an online assignment help company which deals in technical assignment help. We are having experts who are from many leading universities and possess sound experience in providing Professional Java Assignment.

Introduction

This report is based on the application which we programmed. This is mainly prepared to provide the complete understanding of the code which we used to develop this code. The application which we developed is programmed to track all the membership detail of the university library such as: student membership and staff membership. The staff membership detail is collected in the application by recording the first name, last name, library number which is an 8 character string beginning STAFF, gender of the staff, staff number and room number of the staff. The maximum string length for the staff room number is 6 characters long. The information of student membership is collected by recoding the first name, last name, library number, gender, student ID and course code of the student.

The program is developed as java programming language so it is fully object oriented and coded in BLUEj editor.

Code Listing

Member.java

/**

 * The base class for Member

 * This class represents the common details about a member,

 * And also stores the member type

 * @author Author Name

 * @version 1.0

 */

public class Member {

    private int memberShipId;

    private String memberType;

    private String firstName;

    private String lastName;

    private String libraryNumber;

    private String gender;

    /**

     * The public parameterized constructor

     *

     * @param memberShipId

     * @param memberType The type of the member

     * @param firstName The first name of the member

     * @param lastName The last name of the member

     * @param libraryNumber The library number of the member, must be 8 characters

     * @param gender The gender of the member

     */ Read about : PHP Assignment Help

    public Member(int memberShipId, String memberType, String firstName, String lastName, String libraryNumber, String gender) {

        this.memberShipId = memberShipId;

        this.memberType = memberType;

        this.firstName = firstName;

        this.lastName = lastName;

        this.libraryNumber = libraryNumber;

        this.gender = gender;

    }

    /**

     * Returns the member Id

     * @return Returns the member Id

     */

    public int getMemberShipId() {

        return memberShipId;

    }

    /**

     * Returns the member type

     * @return Returns the member type

     */

    public String getMemberType() {

        return memberType;

    }

Read more about Android Assignment Help

    /**

     * Returns the first name of member

     * @return Returns the first name of member

     */

    public String getFirstName() {

        return firstName;

    }

    /**

     * Returns the last name of the member

     * @return Returns the last name of the member

     */

    public String getLastName() {

        return lastName;

    }

    /**

     * Returns the library number of the member

     * @return Returns the library number of the member

     */

    public String getLibraryNumber() {

        return libraryNumber;

    }

    /**

     * Returns the gender of the member

     * @return Returns the gender of the member

     */

    public String getGender() {

        return gender;

    }

    /**

     * Sets the member type

     * @param memberType Sets the member type

     */

    public void setMemberType(String memberType) {

        this.memberType = memberType;

    }

Read more about Dot Net Assignment help

    /**

     * Sets the first name

     * @param firstName Sets the first name

     */

    public void setFirstName(String firstName) {

        this.firstName = firstName;

    }

    /**

     * Sets the last name

     * @param lastName Sets the last name

     */

    public void setLastName(String lastName) {

        this.lastName = lastName;

    }

    /**

     * Sets the library number

     * @param libraryNumber Sets the library number

     */

    public void setLibraryNumber(String libraryNumber) {

        this.libraryNumber = libraryNumber;

    }

    /**

     * Sets the gender

     * @param gender Sets the gender

     */

    public void setGender(String gender) {

        this.gender = gender;

    }

       @Override

    public String toString() {

        return “Member{” + “memberShipId=” + memberShipId + “, memberType=” + memberType + “, firstName=” + firstName + “, lastName=” + lastName + “, libraryNumber=” + libraryNumber + “, gender=” + gender + ‘}’;

    }

    /**

     *Returns a string to be displayed in the text area

     * @return Returns a string to be displayed in the text area

     */

    public String toDisplayString(){

        return toString();

    }

}

StaffMember.java

/**

 * This class represents the staff member.

 * It inherits form the Member class

 * @author  AUTHOR NAME

 * @version  1.0

 */

Read more about Java Programming Assignment Help 

public class StaffMember extends Member {

    private String staffNumber;

    private String roomNumber;

    /**

     * The public parameterized constructor

     * @param staffNumber The staff number

     * @param roomNumber The room number

     * @param memberShipId The membershipId

     * @param firstName The first name of the member

     * @param lastName The last name of the member

     * @param libraryNumber The library number of the member, must be 8 characters

     * @param gender The gender of the member

     */

    public StaffMember(int memberShipId, String firstName, String lastName,

            String libraryNumber, String gender,String staffNumber, String roomNumber) {

        super(memberShipId, “Staff”, firstName, lastName, libraryNumber, gender);

        this.staffNumber = staffNumber;

        this.roomNumber = roomNumber;

    }

    /**

     * Returns the staff number

     * @return Returns the staff number

     */

    public String getStaffNumber() {

        return staffNumber;

    }

    /**

     * Returns the room number

     * @return Returns the room number

     */

    public String getRoomNumber() {

        return roomNumber;

    }

    /**

     * Sets the staff number

     * @param staffNumber The staff number

     */

    public void setStaffNumber(String staffNumber) {

        this.staffNumber = staffNumber;

    }

    /**

     * Sets the room number

     * @param roomNumber The staff room number

     */

    public void setRoomNumber(String roomNumber) {

        this.roomNumber = roomNumber;

    }

    @Override

    public String toString() {

        return “Staff,” + super.getMemberShipId() +

                “,” + super.getFirstName() + “,” + super.getLastName() +

                “,” + super.getLibraryNumber() + “,” + super.getGender() +

                “,” + staffNumber + “,” + roomNumber;

    }

    /**

     * Returns a string to be displayed in the text area

     * @param roomNumber Returns a string to be displayed in the text area

     */

    public String toDisplayString() {

        return “STAFF\nMembership Id : ” + super.getMemberShipId() +

                “\nFirst Name : ” + super.getFirstName() +

                “\nLast Name : ” + super.getLastName() +

                “\nLibrary Number : ” + super.getLibraryNumber() +

                “\nGender : ” + super.getGender() +

                “\nStaff Number : ” + staffNumber +

                “\nRoom Number” + roomNumber;

    }

}

Read more about Thread Life Cycle Java Assignment Help

StudentMember.java

/**

 * This class represents the student member

 * @author

 */

public class StudentMember extends Member {

    private String studentId;

    private String courseCode;

    /**

     * The public parameterized constructor

     * @param studentId The student Id

     * @param courseCode The course code

     * @param memberShipId The membership Id

     * @param firstName The first name of the member

     * @param lastName The last name of the member

     * @param libraryNumber The library number of the member, must be 8 characters

     * @param gender The gender of the member

     */

     public StudentMember(int memberShipId, String firstName, String lastName,

             String libraryNumber, String gender, String studentId, String courseCode) {

        super(memberShipId, “Student”, firstName, lastName, libraryNumber, gender);

        this.studentId = studentId;

        this.courseCode = courseCode;

    }

    /**

     * Returns the student ID

     * @return Returns the student ID

     */

    public String getStudentId() {

        return studentId;

    }

    /**

     * Returns the course code

     * @return Returns the course code

     */

    public String getCourseCode() {

        return courseCode;

    }

    /**

     * Sets the Student ID

     * @param studentId The student Id

     */

    public void setStudentId(String studentId) {

        this.studentId = studentId;

    }

    /**

     * Sets the Course Code

     * @param courseCode The course code

     */

    public void setCourseCode(String courseCode) {

        this.courseCode = courseCode;

    }

    @Override

    public String toString() {

        return “Student,”+ super.getMemberShipId() + “,”  + super.getFirstName() +

                “,” + super.getLastName() + “,” + super.getLibraryNumber() +

                “,” + super.getGender() + “,” + studentId + “,” + courseCode;

    }

Read more about Network Security Assignment Help 

    public String toDisplayString() {

        return “STUDENT\nMembership Id : “+ super.getMemberShipId() +

                “\nFirst Name : ”  + super.getFirstName() +

                “\nLast Name : ” + super.getLastName() +

                “\nLibrary Number : ” + super.getLibraryNumber() +

                “\nGender : ” + super.getGender() +

                “\nStudent Id : ” + studentId +

                “\nCourse Code : ” + courseCode;

    }

}

Read more about Cloud Computing Assignment Help 

Library.java

import java.io.BufferedReader;

import java.io.FileInputStream;

import java.io.IOException;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.PrintWriter;

import java.util.Vector;

/**

 * This class stored data about the staff and student members

 * @author [Author Name]

 * @version 1.0

 */

public class Library {

    //private instace variables

    //vector to store member objects

    private Vector<Member> members;

    //string file name represets the data file name

    private String fileName;

    /**

     * public consturctor

     * @param fileName the data file name

     */

    public Library(String fileName) {

        this.members = new Vector<Member>();

        this.fileName = fileName;

        System.out.println(this.fileName);

    }

    /**

     * Add a member

     * @param member the member to be added to the library

     */

    public void addMember(Member m) {

        this.members.add(m);

    }

    /**

     * returns the total student members count

     * @return returns the total student members count

     */

    public int getStudentCount() {

        int count = 0;

        for (Member m : members) {

            if (m.getMemberType().equals(“Student”)) {

                count++;

            }

        }

        return count;

    }

    /**

     * returns the total staff members count

     * @return returns the total staff members count

     */

    public int getStaffCount() {

        int count = 0;

        for (Member m : members) {

            if (m.getMemberType().equals(“Staff”)) {

                count++;

            }

        }

        return count;

    }

    /**

     * returns the total members count

     * @return returns the total members count

     */

    public int getMemberCount() {

        return members.size();

    }

    /**

     * remove a member from the library

     * @param memberShipId Id of the member

     * @return return boolean if the member is remover, false otherwise

     */

    public boolean removeMember(int memberShipId) {

        int index = -1;

        Member m = null;

        for (int i = 0; i < members.size(); i++) {

            m = members.elementAt(i);

            if (m.getMemberShipId() == memberShipId) {

                index = i;

            }

        }

        if(index == -1){

            return false;

        }

        else{

            members.remove(index);

            return true;

        }

    }

    /**

     * Read all members information  from the file

     * @throws Exception throws exception if the data file not found or the data is not in valid format

     */

    public void readAllMembers() throws Exception {

        members.clear();

        try {

            InputStream ist = new FileInputStream(this.fileName);

            BufferedReader r = new BufferedReader(new InputStreamReader(ist));

            String line;

            String arr[];

            while ((line = r.readLine()) != null) {

                //System.out.println(line);

                arr = line.split(“,”);

                if(arr[0].equals(“Staff”)){

                    members.add(new StaffMember(Integer.parseInt(arr[1]), arr[2], arr[3], arr[4], arr[5], arr[6], arr[7]));

                }

                else if(arr[0].equals(“Student”)){

                    members.add(new StudentMember(Integer.parseInt(arr[1]), arr[2], arr[3], arr[4], arr[5], arr[6], arr[7]));

                }

            }

        } catch (IOException | NumberFormatException e) {

            throw e;

        }

    }

    /**

     * Write all members information to a file

     * @throws Exception throws exception if the file cannot be written

     */

    public void writeAllMembers() throws Exception {

        String fileName = this.fileName.substring(0, this.fileName.indexOf(“.”));

        String fileExt = this.fileName.substring(this.fileName.indexOf(“.”)+1);

        String newFileName = fileName+”1.”+fileExt;

        try{

            PrintWriter writer = new PrintWriter(newFileName, “UTF-8”);

        for(Member m:members)

            writer.println(m);

        writer.close();

        }

        catch(Exception e){

            throw new Exception (e.getMessage());

        }

    }

    /**

     * Returns all members as string

     * @return Returns all members as string

     */

    public String getAllMembers() {

        String str=””;

        for(Member m:members){

            if(str.length()==0){

                str = m.toDisplayString();

            }

            else{

                str += (“\n”+m.toDisplayString());

            }

        }

        return str;

    }

    /**

     * Returns all staff members as string

     * @return Returns all staff members as string

     */

    public String getAllStaffMembers() {

        String str=””;

        for(Member m:members){

            if(m.getMemberType().equals(“Staff”)){

                if(str.length()==0){

                str = m.toDisplayString();

            }

            else{

                str += (“\n”+m.toDisplayString());

            }

            }

        }

        return str;

    }

    /**

     * Returns all student members as string

     * @return Returns all student members as string

     */

    public String getAllStudentMembers() {

        String str=””;

        for(Member m:members){

            if(m.getMemberType().equals(“Student”)){

                if(str.length()==0){

                str = m.toDisplayString();

            }

            else{

                str += (“\n”+m.toDisplayString());

            }

            }

        }

        return str;

    }

    /**

     * return member associated with the membership id

     * @param memberShipId the membership id

     * @return returns the member, null if member not found

     */

    public Member getMember(int memberShipId) {

        Member member = null;

        for(Member m:members){

            if(m.getMemberShipId() == memberShipId){

                member = m;

            }

        }

        return member;

    }

}

Read more about System Analysis and Design Homework Assignment Help

BlueJ Editor was used to create the applicaton

BlueJ Screenshot

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

JavaDocs

Javadocs can be used to take help to for the functionality of the class.

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

Application Screens

It is the main form

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

User can user All Members Button to display all members data

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

User can use Student Members Button to display all student details.

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

Members count can be displayed using Total members Button

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

New user can be added using add User Button

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

We can delete user using the delete button 

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

The following file format is used to read and store members data

Professional Java Assignment, java assignment help, java programming assignment help, top grade assignment help, top grade assignment, assignment help Australia , online assignment help

Note: – the program used the file named data.txt to read members details and it will create a new file data1.txt when the user will save the details.

Conclusion

The developed program for the student/staff membership application for the university library is a very good program. It is fully an object oriented program so it is easy to use and code for the programmers. The developed program has various features and functionality such as: easy and clear graphical user interface which makes it very simple and easy to use for the application user, anyone can easily use and manage it. The application is also implemented with many other features and functionality like application user can easily add new staff and student members, list all members, list all staff  and student members, return the total number of members, easily find the members by just searching the membership number of the member, delete the specific member from list, clear text in any visible windows in the main GUI, save the data in the text file and also exit to the application easily by providing the interface there like buttons, links and search boxes.

This report contains all the codes of the program so the report reader can easily understand the code which is used to developed this application.

Read more about Assignment Help Australia 

References

JavaWorld.(2016). Welcome to JavaWorld.com. [online] Available at: http://www.javaworld.com/ [Accessed 4 May 2016].

Studytonight.com, (2016).Features of Java | Core Java Tutorial | Study tonight. [online] Available at: http://www.studytonight.com/java/features-of-java.php [Accessed 20 Jan. 2016].

www.javatpoint.com, (2015). JVM | Java Virtual Machine – Javatpoint. [online] Available at: http://www.javatpoint.com/internal-details-of-jvm [Accessed 19 Dec. 2015].

www.tutorialspoint.com, (2015). Java Inheritance. [online] Available at: http://www.tutorialspoint.com/java/java_inheritance.htm [Accessed 7 Dec. 2015].

Umlet.com, (2015). UMLet – Free UML Tool for Fast UML Diagrams. [online] Available at: http://www.umlet.com/ [Accessed 10 Dec. 2015].

(Etutorials.org, 2015)Netbeans.org, (2015). Welcome to NetBeans. [online] Available at: https://netbeans.org/ [Accessed 7 Dec. 2015].

Docs.oracle.com, (2015). Advantages of Exceptions (The Java™ Tutorials > Essential Classes > Exceptions).

[online] Available at: https://docs.oracle.com/javase/tutorial/essential/exceptions/advantages.html [Accessed 7 Dec. 2015].

Top grade assignment help is the best assignment help provider in the Australia. Our online Technical Assignment Help is especially dedicated for the students studying in all Australia colleges and universities. Submit assignment to get the best quality assignment help.

Technical Assignment Help,Advantages

 

About the Author

Alice