Here is my homework assignment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bantwini
    New Member
    • Feb 2008
    • 1

    Here is my homework assignment

    Write the class definition for a Circle that has one instance variable (attribute) for the radius. This class must have 2 constructors (one is the default, and the other has one argument).
    Also define appropriate get- and set- methods, as well as methods to return the diameter, circumference, and area of a circle.
    Use the Math class for your calculations.

    Now write another class that contains a main method in which you use each of the constructors to construct 2 Circle objects. Use the Scanner class to get the radius values for each of the objects.
    Now call the appropriate methods to display the radius, diameter, circumference, and area of each of the objects. Use the printf method and the tab escape character to format your output.
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

    Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

    Then when you are ready post a new question in this thread.

    MODERATOR

    Comment

    Working...