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 2 of 2

Thread: Solve Them Please

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Solve Them Please

    Hi everybody
    My english is not good. I have 4 problems must be solved. These are my assignments and I don't have enough time to solve them all. I ask you to solve them.

    These are the problems:



    2. (Date Class) Create class Date with the following capabilities:
    a) Output the date in multiple formats, such as
    MM/DD/YYYY
    June 14, 1992
    DDD YYYY
    b) Use overloaded constructors to create Date objects initialized with dates of the formats in
    part (a). In the first case the constructor should receive three integer values. In the second case it
    should receive a String and two integer values. In the third case it should receive two integer
    values, the first of which represents the day number in the year. [Hint: To convert the string
    representation of the month to a numeric value, compare strings using the equals method. For
    example, if s1 and s2 are strings, the method call s1.equals( s2 ) returns true if the strings are
    identical and otherwise returns false.]


    3. (Rational Numbers) Create a class called Rational for performing arithmetic with fractions.
    Write a program to test your class. Use integer variables to represent the private instance
    variables of the class—the numerator and the denominator. Provide a constructor that enables
    an object of this class to be initialized when it is declared. The constructor should store the
    fraction in reduced form. The fraction
    2/4
    is equivalent to 1/2 and would be stored in the object as 1 in the numerator and 2 in the
    denominator. Provide a no-argument constructor with default values in case no initializers are
    provided. Provide public methods that perform each of the following operations:
    a) Add two Rational numbers: The result of the addition should be stored in reduced
    form.
    b) Subtract two Rational numbers: The result of the subtraction should be stored in
    reduced form.
    c) Multiply two Rational numbers: The result of the multiplication should be stored in
    reduced form.
    d) Divide two Rational numbers: The result of the division should be stored in reduced
    form.
    e) Print Rational numbers in the form a/b, where a is the numerator and b is the
    denominator.
    f) Print Rational numbers in floating-point format. (Consider providing formatting
    capabilities that enable the user of the class to specify the number of digits of precision
    to the right of the decimal point.)


    4. (Huge Integer Class) Create a class HugeInteger which uses a 40-element array of digits to store
    integers as large as 40 digits each. Provide methods input, output, add and subtract. For
    comparing HugeInteger objects, provide the following methods: isEqualTo, isNotEqualTo,
    isGreaterThan, isLessThan, isGreaterThanOrEqualTo and isLessThanOrEqualTo. Each of these
    is a predicate method that returns true if the relationship holds between the two HugeInteger
    objects and returns false if the relationship does not hold. Provide a predicate method isZero. If
    you feel ambitious, also provide methods multiply, divide and remainder. [Note: Primitive
    boolean values can be output as the word “true” or the word “false” with format specifier %b.]


    5. Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle
    and Square. Use Quadrilateral as the superclass of the hierarchy. Make the hierarchy as deep
    (i.e., as many levels) as possible. Specify the instance variables and methods for each class. The
    private instance variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints
    of the Quadrilateral. Write a program that instantiates objects of your classes and outputs
    each object’s area (except Quadrilateral).

    And this is its pdf file:
    http://cw.sharif.edu/file.php/661/hw4.pdf
    hw4 pdf



    HELP ME PLEASE!


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Solve Them Please

    Sorry, but the purpose of this forum is not to do your homework for you. Please attempt each of these problems, then if you get stuck post your code and what you need help with specifically. If you're getting an exception, please post it in it's entirety.

Similar Threads

  1. solve it plz
    By tillu in forum Java Theory & Questions
    Replies: 4
    Last Post: December 17th, 2010, 12:45 PM
  2. Plz solve the problem
    By rasheedmgs in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: October 14th, 2010, 11:59 AM
  3. Questions about a Problem I'm trying to solve
    By DarkEssence in forum Java Theory & Questions
    Replies: 4
    Last Post: March 17th, 2010, 06:29 AM
  4. i do not know how to solve this issue
    By javastupi in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 20th, 2010, 07:28 PM
  5. Replies: 3
    Last Post: June 14th, 2009, 09:31 PM