Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment1 Submit.jave file for each question or copy the code in the word file and poste the screenshot of the output as well. Due: 3-Feb-2022

image text in transcribed
Assignment1 Submit.jave file for each question or copy the code in the word file and poste the screenshot of the output as well. Due: 3-Feb-2022 till 10 A.M(Morning) Q1: Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle's perimeter and area. It has set and get methods for both length and width. The set methods should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle. Q2: Create class Date with the following capabilities: a) Output the date in multiple formats, such as MM/DD/YYYY June 14, 1992 ODD 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, ifsi and s2 are Strings, the method call si.equals(2) returns true if the Strings are identical and otherwise returns false)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Oracle Fusion Applications Installation And Administration

Authors: Tushar Thakker

1st Edition

1484209834, 9781484209837

More Books

Students also viewed these Databases questions

Question

Our service is (good) than theirs.

Answered: 1 week ago

Question

Here is the (interesting) of all the ideas I have heard so far.

Answered: 1 week ago