CS506 Assignment 2 Solution and Discussion


  • Cyberian's Gold

    Re: CS506 Assignment 2 Solution and Discussion

    Please read the following instructions carefully before solving & submitting assignment:

    Uploading Instructions:
    • You are not allowed to use any other software/IDE except NetBeans IDE for this assignment development.
    • The submission must be a complete NetBeans IDE project folder (which should contain complete source code, Java files, database file and builds etc.). After finalizing, compress it with Zip or RAR format, save with your own Student ID (e.g. bc000000000.zip) and submit it at VU-LMS within due date.
    • Your assignment should be in .zip /.rar format. Other file formats will not be accepted.
    • No assignment will be accepted through email.

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

    o The assignment is submitted after due date.
    o The assignment is not submitted in .zip /.rar format.
    o The submitted assignment does not open or file is corrupted.
    o The assignment is fully or partially copied from other student or ditto copy from handouts or Internet; strict disciplinary action will be taken in this case.
    o The submitted code is unable to compile/execute in NetBeans IDE; during evaluation, submitted code will be checked on NetBeans IDE. If unable to execute then ZERO marks will be awarded and no excuses will be accepted in this regard.

    Note: Do not put any query on MDB regarding this assignment, if you have any query then email at [email protected]
    Lectures Covered: This assignment covers Lectures # 1-16

    GOOD LUCK

    Problem Statement:
    You are required to develop a Java program named MyATM, which should simulate behavior of a typical ATM (Automated Teller Machine). In which a user, after entering card details, can deposit amount, withdraw cash and check current balance. The program should be based on a user friendly interface; need to use Java Swing based GUI components for this purpose. Further, all information must be saved in a backend database using MS Access.

    Detailed Description:
    At start, your program should ask the user to provide card number and pin code as input. After taking input from user the program should fetch user data corresponding to the input values from database and store in a class level global variable. Taking input from user is shown in figure no 1.

    Fig. 1: Taking input from User

    If input values are correct (i.e. found a user against provided card number and pin code) then following ATM services should be displayed via GUI;

    1. Deposit Amount
    2. Withdraw Cash
    3. Check Balance

    Fig. 2: ATM Services GUI

    However, in case if input values are not correct (i.e. found no user against provided card number and pin code) then appropriate message should be shown, like; “Invalid Card No or Wrong Pin Code”.

    1. Deposit Amount:

    Each time, user selects this option, s/he will be prompted to enter money for deposit that must be in multiple of Rs. 500/- (hint is given below) and up to a maximum of Rs. 25000/- per transaction. If inputs are correct then the amount must be added in current balance and as well as in database. However, in case of wrong input, appropriate message should be displayed.

    Fig. 3: Deposit Amount GUI
    2. Withdraw Cash:

    User can withdraw any cash but in multiple of Rs. 500/- (hint is given below) and up to a maximum of Rs. 25000/- per transaction by using this option. However, if balance is zero or withdraw amount is greater than the balance, then appropriate message should be displayed. Otherwise, amount must be deducted from current balance and as well as database should be maintained.

    Fig. 4: Cash Withdraw GUI

    1. Check Balance:

    The program should fascinate the user by displaying the current balance as well via GUI.

    Fig. 5: Check Balance GUI
    Note: At the end of each successful transaction, the user must be asked to proceed with another transaction or not; if yes then start from displaying ATM services again and if not then show developer information (i.e. Student Id and name) via GUI.

    Fig. 6: Developer Info
    Required Stuff:
    Java Classes:
    DebitCard.java (id,username,cardno,pincode,balance)
    DbHelper.java (should contain all database related code)
    MainClass.java (should contain GUI code)

    Database file:
    BSxxxxxxxx.accdb (must be same as your own VU student id)

    Note: need to put database file in assets folder in NetBeans project directory; as shown below;

    Fig. 7: Folder “assets” in NetBeans project directory
    Sample Data:
    Id Username Card No Pin Code Balance
    1 Ahmad 20201001 1041 3000
    2 Ali 20201002 1226 0
    3 Sana 20201003 2592 7000
    4 Amna 20201004 6372 12000
    5 Umar 20201005 9241 25000

    Tab. 1: Sample Users Data

    Tab. 2: Users Table in MS Access Database file
    Hint:
    if (amount % 500 == 0) {
    // it is a multiple of 500.
    }

    Setup Files & Video Tutorials:
     To download JDK setup file for Windows x64 , Download;

     To download JDK setup file for Windows x32 , please visit;

     To install JDK and create a HelloWorld program in Java, please watch;

     To install & create a HelloWorld Java program in NetBeans IDE, please watch;

     To use UCanAccess driver to connect with MS Access database, please watch;

    Important Things to Implement:
     For GUI, relevant components (i.e. JFrame, JPanel, JButton, JTextArea, JTextField and JLable etc.) from AWT and Swing packages should be used.
     You will have to use UCanAccess driver to connect to MS Access database. In this case, you are suggested to view the video tutorial shared above.
     For storing/fetching data to/from database, you will need to use proper SQL queries.
     Data must be stored/fetched to/from database table in the form of Java class object/s.
     You can use same Java classes (DebitCard and DbHelper etc.) as provided in assignment # 1 and also can make changes as required.
     Java classes must have proper Data Members and Member Functions along with Constructors, Standard Setters and Getters etc.
     Need to make sure that exceptions are managed properly throughout the program; especially NullPointerException, NumberFormatException, ClassNotFoundException and SQLException etc.
     All images, tables and sample data, given in this document, are just for reference purpose only; you have to provide your own implementations. It is not required to be exactly the same.

    Good Luck



Quiz 100% Result Quiz 100% Result
| |