Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: College Assignment

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default College Assignment

    I have been learning java in college for about 6 weeks now, our latest assignment seems overly complicated so I was wondering if anyone could help me out.

    https://www.dropbox.com/s/rv20cm39si...n%202%29_2.pdf

    This is my code so far, any help on any of the further parts which I have not completed yet would be greatly appreciated

    Oh and just so you know we are using bluej.

    Employee Class

          public class Employee
    {
        private int employeeNumber;
        private String employeeName;
        private String employeeAddress;
        private double annualIncome;
        private int taxCategory;
        private Department dept;
     
        /**
         * Constructor for objects of class Employee
         */
        public Employee(int employeeNumber, String employeeName,
                        String employeeAddress, double anualIncome, int taxCategory, Department dept)
        {
            if((employeeNumber >= 1000) && (employeeNumber <= 9999))
            { 
                this.employeeNumber = employeeNumber;
            }
            else
            {
                System.out.println("EmployeeNumber can only be 4 characters long");
                this.employeeNumber = 1000000; //default value
     
            }
     
            if(employeeName.length() <= 20)
            {
                this.employeeName = employeeName;
            }
            else
            {
                System.out.println("employeeName cannot be more than 2 characters");
                this.employeeName = "Not Set"; //Default Input
            }
     
            this.employeeAddress = employeeAddress;
     
            if(annualIncome >= 0)
            {
                this.annualIncome = annualIncome;
            }
            else
            {
                System.out.println("AnnualIncome must be non-negative");
                this.annualIncome = 0; //Default Value
            }
     
            if((taxCategory > 0) && (taxCategory < 3))
            {
                this.taxCategory = taxCategory;
            }
            else
            {
                System.out.println("There are only two valid values 1 = Single or 2 = Married on one income");
                this.taxCategory = 1; //Default Value
            }
        }
     
        public int getEmployeeNumber()
        {
            return employeeNumber;
        }
     
        public String getEmployeeName()
        {
            return employeeName;
        }
     
        public String getEmployeeAddress()
        {
            return employeeAddress;
        }
     
        public double getAnnualIncome()
        {
            return annualIncome;
        }
     
        public int getTaxCategory()
        {
            return taxCategory;
        }
     
     
        public void setEmployeeNumber(int employeeNumber)
        {
            if((employeeNumber >= 1000) && (employeeNumber <= 9999))
            {
                this.employeeNumber = employeeNumber;
            }
            else
            {
                System.out.println("employeeNumber Should be no more than 4 digits");
            }
        }
     
        public void setEmployeeName(String employeeName)
        {
            if(employeeName.length() <= 20)
            {
                this.employeeName = employeeName;
            }
            else
            {
                System.out.println("employeeName must be no more than 20 characters");
            }
        }
     
        public void setEmployeeAddress(String employeeAddress)
        {
            this.employeeAddress = employeeAddress;
        }
     
        public void setAnnualIncome(double annualIncome)
        {
            if(annualIncome >= 0)
            {
                this.annualIncome = annualIncome;
            }
            else
            {
                System.out.println("annualIncome must be non-negative");
            }
        }
     
        public void setTaxCategory(int taxCategory)
        {
            if((taxCategory > 0) && (taxCategory < 3))
            {
                this.taxCategory = taxCategory;
            }
        }
     
     
        public double calculateAnnualTax()
        {
          if(taxCategory == 1)
          {
              if(annualIncome <= 32000)
              {
     
     
              }
     
          }
          else if(taxCategory == 2)
          {
     
          }
        }
    }

    Department Class
          public class Department
    {
        private String deptName;
        private String deptHead;
        private String deptAdministrator;
     
        /**
         * Constructor for objects of class Department
         */
        public Department(String deptName, String deptHead, String deptAdministrator)
        {
            if(deptName.length() <= 30)
            {
                this.deptName = deptName;
            }
            else
            {
                System.out.println("deptName should eb no more than 30 characters long");
                this.deptName = "default"; //defaultValue
            }
     
            if(deptHead.length() <= 20)
            {
                this.deptHead = deptHead;
            }
            else
            {
                System.out.println("deptHead should be no longer than 20 characters long");
                this.deptHead = "default"; //defaultValue
            }
     
            if(deptAdministrator.length() <= 20)
            {
                this.deptAdministrator = deptAdministrator;
            }
            else
            {
                System.out.println("deptAdministrator should be no longer than 20 characters");
     
            }
        }
     
     
        public String getDeptName()
        {
            return deptName;
        }
     
        public String getDeptHead()
        {
            return deptHead;
        }
     
        public String getDeptAdministrator()
        {
            return deptAdministrator;
        }
     
     
        public void setDeptName(String deptName)
        {
            if(deptName.length() <= 30)
            {
                this.deptName = deptName;
            }
            else
            {
                System.out.println("deptName should be no more than 30 characters long");
            }
        }
     
        public void setDeptHead(String deptHead)
        {
            if(deptHead.length() <= 20)
            {
                this.deptHead = deptHead;
            }
            else
            {
                System.out.println("deptHeadmust should be no more than 20 charcters");
            }
        }
     
        public void setDeptAdministrator(String deptAdministrator)
        {
            if(deptAdministrator.length() <= 20)
            {
                this.deptAdministrator = deptAdministrator;
            }
            else
            {
                System.out.println("deptAdministrator should be no more than 20 characters");
            }
        }
     
     
    }


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: College Assignment

    Quote Originally Posted by EpsilonCM View Post
    I have been learning java in college for about 6 weeks now, our latest assignment seems overly complicated so I was wondering if anyone could help me out. ...
    Please post your assignment text here in the forum, and then ask specific questions about this assignment that confuses you.

    This is my code so far, any help on any of the further parts which I have not completed yet would be greatly appreciated...
    In my experiences, open ended questions such as this are very difficult to answer, and often don't get direct answers, but more frequently result in links to this or that tutorial. If you desire more specific answers and help, you're going to have to put in some effort in formulating your questions here (which is an art in its own right) by trying to ask more specific questions.

    Best of luck and welcome to the javaprogramming forums.

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: College Assignment

    Quote Originally Posted by curmudgeon View Post
    In my experiences, open ended questions such as this are very difficult to answer, and often don't get direct answers, but more frequently result in links to this or that tutorial.
    I did add my assignment text its the pdf link at the top, to be honest I was really just looking for someone to point me in the right direction with tutorial as I am just wanting to learn as much as possible without the answer being blankly given to me, Thanks anyway

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: College Assignment

    We'll be glad to help, but again, you'll get more folks likely willing to read your assignment if you type in the text of the assignment here in the forum. Many don't like clicking on links. This is being posted in the spirit of trying to help you get more and better help sooner. Best of luck!

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: College Assignment

    Bro, u are even lucky, do u know we many programmers who selfstudied for months and missing classroom experience as well. Will u believe I 've attempted your assignment and 'll definitely post d problems I 've encountered to the forum, u better act fast!.... Welcome 2 d forum.

Similar Threads

  1. College Assignment please help
    By The Lost Plot in forum Collections and Generics
    Replies: 7
    Last Post: March 13th, 2012, 10:27 AM
  2. College project: XML file from PC to Android
    By StudioGilliam in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: March 1st, 2012, 05:42 AM
  3. Finding college level problems
    By DougFane in forum The Cafe
    Replies: 1
    Last Post: February 2nd, 2012, 08:44 AM
  4. PLEASE HELP ME WITH MY COLLEGE LAB!
    By crsoccerplayer6 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: October 29th, 2011, 05:06 PM
  5. College Course-Array
    By samuel17 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 14th, 2010, 11:29 PM