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!