Java Programm


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Java Programm

Hybrid View

  1. #1
    Join Date
    Mar 2005
    Posts
    2

    Java Programm

    1212

    Hi Guys,
    I need a big favour from u. I'm finding difficulty in doing this program.
    This is the question- i'm facing difficulty.

    Exercise 1:Identify suitable attributes and methods for a company and an employee classes respectivley. Implement both classes in Java.Your methods must reflect at least three collaborative roles for each class. For instance, collaborative roles for a company might include hiring,firing and paying an employee. On the other hand, employee colloborative roles may include working for, managing, or promoting a company.

    Exercise 2: Taking into account most employees are obliged to make National Insurance(NI) and Tax contributions, what other class(es) would you consider appropriate to ensure our simple Object-oriented System deals with NI and taxes effectively? (NB: you are not required to implement the classes you consider here, but please justify their selection)

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    What is it you're having difficulty with specifically? If you show us what you've done we can help you.

  3. #3
    Join Date
    Jan 2005
    Location
    Reisterstowwn, MD
    Posts
    72
    I'm not going to do your homework for you because its you who needs to learn it. But the idea is to make classes that represent these real life models. The key is picking out nouns and verbs. So given the statement "For instance, collaborative roles for a company might include hiring,firing and paying an employee" you need to first pick out the nouns and verbs. Nouns are normally classes and verbs are methods of these classes
    Noun: company, employee
    Verbs: hiring, firing, paying

    As for you data members, just think of what things make up a company, you dont have to make a compeltly thorough list, just some main points. For example stuff like: employees, date founded, location, title, etc. (Note that employee is a very broad term, and might encompass its own sub attributes, this makes it the perfect canidate to have its own class). Heres a small example of how the classes might look:

    Code:
    class Company{
        private String name;
        private Employee[] employees;
        ...
        public Company(String name, Employee employees){
        this.name = name;
        this.employees = employess;
        ....
        }
    }
    
    class Employee{
        private String firstName, lastName, title;
        ....
    }
    I'll let you figure out the second question yourself, hope this helps.
    Java has 99 problems but a pointer ain't one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center