Results 1 to 7 of 7
  1. #1
    gauravdrocker is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default when to use abstract classes

    Hello,

    I am trying to develop a module for a bigger application. The module and application itself is quite simple. But they want me to use abstract classes in this.Please suggest some classes that can be made abstract for this application.

    The application is :

    An application for the employee salary distribution system needs to be made. An initial data base of 500 employees will suffice. It should contain the first name, last name, age, employee id, department, designation, salary and duration since first joined the company as fields. An annual increment of 30% should be added to the existing salary. We should be able to see the salary of the employee on any date with proper increments. Once the age of the employee reaches 60 years, a notification should pop up on the system that its their retirement age and after 10 minutes of the notification pop up, the details of the employee should automatically move to a new data base; say ex- employees. Also on every 1st of the month, a notification should pop- up that salary needs to be distributed. We should be able to check all these functionalities by providing a date of our choice in the application. A proper graphical interface should be provided for this application.

    I have started working on this. I used MVC for this and I also submitted a class diagram for this . But they want me to use abstract classes modularity. Please help me .. I have attached the basic class diagram.

    this is what i have thought so far

    Package Model;
    ConnectionManager.java
    public static Connection getConnetion(String DBName,String DBUserName,String DBPassword);

    DataUpdate.java
    public static bool insert(String[] fields);

    public static bool update(String[] fields);

    public static bool delete(string fields);


    RetrieveData.java
    public static String[] get(String[] fields);


    Package Controller;
    Salary.java
    public static void checkDate(Date newDate);

    private static void distribute_salary();

    Retire.java
    private static Date currentDate=new Date();

    static void checkAge( Date newDate);

    Increement.java
    private static Date CurrentDate=new Date();

    public static void checkDate(Date newDate);

    private void updateSalary( Float Sal);

    Main.java
    public static void main(String[] args);


    Package View;
    Form.java
    public static buildForm();

    //events handlers for GUI components which contain calls to functions in controller

    Popup.java
    public void displayPopUp(String Text);

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: when to use abstract classes

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Kagiso is offline Member
    Join Date
    Nov 2012
    Location
    Johannesburg, South Africa
    Posts
    92
    Rep Power
    0

    Default Re: when to use abstract classes

    Answering the question "WHEN TO USE ABSTRACT CLASS"

    We use abstract class when we don't want the class to be instantiated e.g.
    MyClass c = new MyClass(); // this won't compile if myClass is abstract

    We use abstract class when don't want to implement some methods in our abstract superClass only provide a method's signature for subclasses to implement e.g.
    Java Code:
    abstract class SuperClass {
        void doSumThing(); // All concrete subclasses  of SuperClass will have to implement this method
    }

  4. #4
    gauravdrocker is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default Re: when to use abstract classes

    is this and coderanch same site ?

  5. #5
    gauravdrocker is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default Re: when to use abstract classes

    sir i already know that.. bt the problem is I don't know which class should i make abstract when designing the class hierarchy..
    pl help in designing the class hierarchy

  6. #6
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default Re: when to use abstract classes

    Quote Originally Posted by gauravdrocker View Post
    is this and coderanch same site ?
    No, that's why it's crossposted and not multiposted.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  7. #7
    gauravdrocker is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

Similar Threads

  1. abstract classes
    By droidus in forum New To Java
    Replies: 1
    Last Post: 12-09-2012, 03:44 AM
  2. Help with Abstract Classes please.
    By fatabass in forum New To Java
    Replies: 1
    Last Post: 03-23-2012, 04:26 AM
  3. Abstract classes
    By FadedAura in forum New To Java
    Replies: 4
    Last Post: 11-21-2011, 11:16 PM
  4. Abstract Classes.
    By maknib in forum New To Java
    Replies: 3
    Last Post: 05-12-2011, 03:30 PM
  5. abstract classes
    By renju krishnan in forum New To Java
    Replies: 1
    Last Post: 09-29-2010, 09:31 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •