question archive (JAVA Coding)? IMPORTANT NOTE: USE ANY OF THE JAVA BUILT-IN CLASSES NOT PERMITTED, SUCH AS ArrayLists, Hash Maps, etc
Subject:Computer SciencePrice: Bought3
IMPORTANT NOTE: USE ANY OF THE JAVA BUILT-IN CLASSES NOT PERMITTED, SUCH AS ArrayLists, Hash Maps, etc.
need to code whatever needed !!!
There must be 2 different Java packages for the classes.
The first package will include the Address class.
The second package will include the WebPageAddress, EmailAddress and the TelecomAddress classes.
The Classes!
An Address represents information that can be used to contact a Party. A Party represents a person or an organization. In general, an Address may specify business, home, out-of-hours contact, emergency contact, and so on.
Each address specifies the usable time of the Address (i.e., limit the context in which the Address is applicable/valid. In other words, an Address has the following attributes: validFrom (String type representing a date in the format "YYYY-MM-DD") and validTo (String type representing a date in the format "YYYY-MM-DD") to specify and limit the use of an Address. Any address that falls out of the date limits is still and address, but considered to be obsolete. Notice that the dates can be future dates (yet to become valid). These Addresses are also obsolete for instance compared to the current date.
There are three kinds of address objects: WebPageAddress, EmailAddress, TelecomAddress,
− A WebPageAddress represents the URL for a Web page related to the Party. A URLs has the following form "www.domainName/resourceName" as String type where the resourceName is optional.
− An EmailAddress specifies a way of contacting a Party via email. Each EmailAddress has 5 String parts: userName, "@", domainName, ".", and TLD in the following form "..e@domainName.TLD" (where Top Level Domain (TLD) can be com, org, gov, etc.).
− A TelecomAddress represents a number that can contact a telephone, mobile phone, fax, pager, or other telephonic device. The International Telecommunication Union (www.itu.int) provides standards for TelecomAddresses. Each TelecomAddress is made up of the parts shown below as an example:
+1 (0)208 1234567 ext. 789 mobile
The "+1" is the International Direct Dialing (IDD) for a country. Almost each country in the world has its own country calling code, it is a single- or up to three-digit number which you have to dial to make a call to that country. Note this country code is not the same as the ISO 3166 country code (see below). For example, "+1" represents all countries in North America, "+2" represents all countries in Africa, etc.
The "(0)" is the National Direct Dialing prefix (NDD).
The "208" is the area code.
The "1234567" is the number.
The "789" is the extension.
The "mobile" is the physicalType.
In summary, a TelecomAddress has a countryCode, a nationalDirectDialingPrefix (the prefix to make a call within a country between different cities or areas), an areaCode , a number (the telephone number), an extension accessible via the number, and a physicalType (the type of device, such as phone, fax, mobile, pager, and so on). The area code and the extension are of integer type; the number is a long integer type. The rest of the parts are String types.
For each of the classes, should have a default constructor, a parameterized constructor and a copy constructor.
An object creation using the default constructor must trigger the default constructor of its ancestor classes, while creation using parameterized constructors must trigger the parameterized constructors of the ancestors.
− The toString() method must return a clear description and information of the object (For example: "This email address d..p@cleancode.app is valid from 2018-01-31 to 2021-12-31 and therefore still usable today").
The equals() method must first verify if the passed object (to compare to) is null and if it is of a different type than the calling object.
? In the driver program Besides the main() method, it should include a method called traceObsoleteAddresses(). This method takes four parameters, an array of Addresses, and three integer values representing a date (YYYY, MM, DD). The method must search in the array of Addresses and display all addresses that are/were obsolete in comparison the passed date. For example, if the passed date is 2021, 02, 15 and an Address has date limits of 1998-05-21 and 2010-10-03, then this Address is obsolete. Again, you should notice that Addresses can have future dates (yet to become effective). For instance, if the passed date is 2021, 02, 15 and an Address has date limits of 2021-10-18 and 2023-4-20, then this Address is also obsolete in relation to the passed date.
In the main() method you must:
? Create various objects from the 3 classes, and display all their information (you must take advantage of the toString() method). Some of them must be obsolete addresses, limiting their usage only between validFrom and validTo dates.
? Test the equality of some of the created objects using the equals() method. by an array of 4 to 6 these address objects
? Call the traceObsoleteAddresses() method with the array created above, along with any date of. The method should trace and display all information of all obsolete Addresses along with their location (index) in the array.