CS506 Assignment No. 02
 Solution and Discussion

  • Cyberian's Gold


    Assignment No. 02
Semester: Spring 2019
    CS506 – Web Design and Development

    Total Marks: 20

    Due Date: 31/05/2019

    Uploading instructions:

    • It must be complete NetBeans IDE project folder (which should contain complete source code, text files, and builds etc.). After finalizing, compress it with Zip or RAR format and submit it at VU-LMS within due date.
    • Your assignment should be in .zip /.rar format. Other file formats will not be accepted.
    • Save your assignment with your ID (e.g. bc000000000.zip).
    • No assignment will be accepted through email.

    Rules for Marking:

    It should be clear that your assignment will not get any credit if:

    • The assignment is submitted after due date.
    • The submitted assignment does not open, execute or file is corrupted.
    • It is not NetBeans IDE project (any other format will not be accepted in any case).
    • Your assignment is copied from internet, handouts or from any other student (strict disciplinary action will be taken in this case).
    • Do not put any query on MDB about this assignment, if you have any query then email at [email protected]


    Problem Statement:

    You are required to develop a Java program, named Hospital Management System for a typical medical treatment center; in which you will fetch doctors and patients detail from database and schedule appointments. Further, user can search an appointment for a particular patient as well; all data will be shown to user via GUI.

    Detailed Description:

    For this purpose, you have to create one MS Access Database file (the name of file must be same as your own VU ID i.e. BS00000000.accdb) and two Java classes (i.e. Appointment and MainClass). Database file should contain two tables (i.e. Doctors and Patients);

    Fig. 1: Doctors Table in Database

    Fig. 2: Patients Table in Database

    Appointment class should have the following data members and member functions;

    ¥ no: int
    ¥ patient: String
    ¥ doctor: String
    ¥ disease: String
    ¥ scheduledDay: String
    ¥ Constructors: default, parameterized and copy constructor
    ¥ Standard Setters: setNo(…), setPatient(…), setDoctor(…),
    setDisease(…), setScheduledDay (…)
    ¥ Standard Getters: getNo(), getPatient(), getDoctor(),
    getDisease(), getScheduledDay()
    MainClass must contain the main() method which should initialize all GUI components and display following two buttons;

    1. Appointments

    2. Search

    3. Appointments:

    The program will schedule the appointments by matching patient’s diseases with doctor’s specializations by using SQL selection query* and will display the result on GUI; needed to use Swing table component (i.e. javax.swing.JTable).

    *Sample SQL query:

    SELECT … FROM Patients, Doctors
    WHERE Patients.Disease = Doctors.Specialization

    Fig. 3: Appointments Detail on GUI

    1. Search:

    And, when user clicks on “Search” button then ask user to enter CNIC of a patient (using JOptionPane.showInputDialog). If input is correct (i.e. found no empty/null value) and corresponding patient is found in database then schedule an appointment by matching his/her disease with doctor’s specialization, otherwise a message should be displayed “Found no Patient”.

    *Sample SQL query:

    SELECT … FROM Patients, Doctors
    WHERE Patients.Disease = Doctors.Specialization
    AND Patients.Cnic = ‘proivdedCnic’

    Fig. 4: Search Result

    The above given images are just for reference purpose only; you will be making your own GUIs. It is not required to be exactly the same.


    Table. 2: Sample Data for Patients Table in Database

    Important Regarding Development:

    If you are using JDK1.8 or above then you’ll have to use ucanaccess driver to connect to MS Access database. In this case, I’ll suggest you to view the following tutorial.


    Following links will be helpful in creating new database in MS Access.


    Important Things to Implement:
    ¬ Java Classes must have proper Data Members and Member Functions along with Constructor/s, Setters and Getters etc.
    ¬ Data will be fetched from database in the form of Java class object/s.
    ¬ For GUI, relevant components (i.e. JFrame, JPanel, JScrollPane, JTable, JButton, and JLable etc.) from AWT and Swing packages should be used.
    ¬ For fetching data from database, you need to use proper SQL queries.
    ¬ Need to make sure that exceptions are managed properly throughout the program.


    Deadline: Your assignment must be uploaded/submitted on or before 3rd June 2019.

  • Cyberian's Gold

    Attached file Solution idea

  • Cyberian's Gold

  • Cyberian's Gold

Insaf Sehat Card Live Cricket Streaming
Quiz 100% Result Quiz 100% Result
| |