subject
Engineering, 22.04.2020 01:46 Dmgirl123

The class defines the following private instance variables: a. recipient -a string representing the person receiving the package. b. numberOfItems - an integer representing the number of items in the package. c. description - a string describing the package’s contents.2. You can define additional instance variables.3. You can define constants (static final), but do not define static variables that can be modified.4. Constructor #1 - Takes a recipient, a number of items, and a description as parameters. It initializes the corresponding instance variables. If recipient is null, an IllegalArgumentException will be thrown (any message is fine) and further initialization will not take place.5. Constructor #2 - Takes a recipient and a description as parameters. It assumes the number of items is one. If recipient is null, an IllegalArgumentException will be thrown (any message is fine) and further initialization will not take place.6. Copy Constructor - Define a copy constructor for the class.7. addItem - Takes a string as a parameter representing the description of an item. The method will append the parameter string to the description instance variable. The number of items will be adjusted accordingly. If the parameter is null, no item will be added. The method returns a reference to the current object.8. getRecipient - Get method for recipient.9. getNumberOfItems - Get method for number of items.10. getDescription - Get method for description.11. getPackageCost – Returns an integer value representing the package cost. The cost of the package is based on the number of items. Each item costs $2. For example, if a package has 3 items, the cost will be $6.12. equals - Define an equals method for the class. Two packages are considered the same if they have the same recipient and the same number of items. The package’s description is ignored.13. merge – This method has a MailPackage as a parameter, and it will merge two packages if they have the same recipient. To merge two packages, the number of items in the current object will be increased by the number of items in the parameter object. In addition, the description associated with the parameter object will be appended to the description of the current object. If the method tries to merge to itself, no processing will take place. If the method tries to merge to a package that has a different recipient, an IllegalArgumentException (with any message) will be thrown. The method returns a reference to the current object.14. compareTo – This method will allow us to compare two MailPackage objects. It has a MailPackage as parameter and returns an integer. You can use the String class compareTo method during the implementation of this method. The MailPackage compareTo method will return:a. A negative value if the number of items of the current object is less than the parameterb. A positive value if the number of items of the current object is greater than the parameter. c. If the current object and the parameter have the same number of items, the method will return:i. A negative value if the recipient of the current object precedes the recipient of the parameter in alphabetical order. ii. A positive value if the recipient of the current object follows the recipient of the parameter in alphabetical order. iii. 0 otherwise.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
For the closed feedwater heater below, feedwater enters state 3 at a pressure of 2000 psia and temperature of 420 °f at a rate of ix10 ibhr. the feedwat extracted steam enters state 1 at a pressure of 1000 psia and enthalpy of 1500 btu/lbm. the extracted er leaves at an enthalpy of 528.7 btu/lbm steam leaves as a saturated liquid. (16) a) determine the mass flow rate of the extraction steam used to heat the feedwater (10) b) determine the terminal temperature difference of the closed feedwater heater
Answers: 3
question
Engineering, 04.07.2019 18:20
Wiy doeres rere okhn a pump whon working betwon the same pressure range?
Answers: 2
question
Engineering, 04.07.2019 19:10
Abarometer contains mercury with a density of 13600 kg/m3. atmospheric conditions are 95.8 kpa and 20 °c at 20 °c, the vapor pressure of the mercury is 0.000173 kpa. the column of mercury will rise to a height of most nearly. select one: a)- 0.38 m b)- 0.82 m c)- 0.48 m d)- 0.72 m
Answers: 1
question
Engineering, 04.07.2019 19:10
Which of the following is the most important advantage of a large field of view? a. allows larger areas to be examined b. relieves eyestrain c. minimizes parallax errors. d. increases precision in proportion to the in- crease in field of view
Answers: 2
You know the right answer?
The class defines the following private instance variables: a. recipient -a string representing the...
Questions
question
Mathematics, 23.07.2019 01:30