Results 1 to 2 of 2
  1. #1
    larson1118 is offline Member
    Join Date
    Apr 2011
    Rep Power

    Default New to Java and very confused.

    First let me state that this is a HW assignment and I absolutely do not want it done for me - I am making every effort to learn this on my own. I am just looking for input on where to start.

    Here is the assignment:
    Create a Java class to implement the Angle class, described below. The class should represent a mathematical angle with a value between 0 and 359 degrees. Required elements:

    * an instance variable that represents the degree of the angle
    * accessor (getter) methods that return the angle in degrees and in radians (2 separate methods)
    * mutator (setter) methods that are analogous to the accessor methods; note that these must enforce the restriction about degree of angle stated above
    * constructors:
    - a default constructor that sets degrees to 0
    - a single-argument constructor that takes an argument representing degrees and sets the angle degree accordingly; note that this must enforce the degree specification 0 <= angle < 360
    * accessor methods that return the following information about the angle:
    * accessor methods that return the values;
    - isAcute
    - isObtuse
    - isRight
    - isStraight
    - isReflex
    * a compareTo method that compares the calling object with another Angle object and returns a 1, 0 or -1 as a result of the comparison (results mean the same as they do in the String and Fraction versions)
    * a main method that tests all of the other methods, using a loop so that the user can control the number of repetitions.
    I understand what the Class is used for along with the getter and setter methods, but I don't understand how to put it all together. Are there any good examples that show something similar...or does anyone have any input on where they would start with this?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    I'd go through the instructions one at a time, creating methods as defined by the instructions. If you're stumped by an instruction or your code has bugs, then come on back with your questions and your code.

    Remember though to compile often and to not add any code if you have compilation errors until the errors have been fixed. A good link that can help you is the last one in my signature links below, "So, You Need to Write a Program..."

    Good luck and welcome to the forum!

Similar Threads

  1. Confused myself learning Java... please help
    By N00Bie in forum New To Java
    Replies: 7
    Last Post: 02-18-2011, 01:33 AM
  2. general confused about java question (easy!)
    By sweetjava in forum New To Java
    Replies: 1
    Last Post: 08-09-2009, 02:03 AM
  3. Lost and confused - Java/j and mxj
    By etherkye in forum JDBC
    Replies: 1
    Last Post: 07-02-2009, 06:35 PM
  4. New to java a little confused.
    By Dometic in forum New To Java
    Replies: 10
    Last Post: 12-08-2008, 12:56 AM
  5. Java confused over Generics?
    By Bibendum in forum New To Java
    Replies: 3
    Last Post: 12-26-2007, 07:23 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