Question: this is java program please help Method File - Class GenericArrayMethods Generic method Print Receives parameters Description (data type: String) and an Array. Method will

this is java program please help

Method File - Class GenericArrayMethods

  • Generic method Print Receives parameters Description (data type: String) and an Array. Method will display the value of Description. On separate lines, display each element of the Array.
  • Generic method Initialize Receives parameters Initializing Value and an Array. Method will set all array elements equal to the Initializing Value.

Main File - Class LabActivityGenerics

  • Declare a constant Number fo Buildings and set its value to 3
  • Declare an appropriate object subclass Building Cost array (currency: $, size: Number of Buildings)
  • Call the generic method Initialize passing it -1 and the array.
  • Call the generic method Print passing it "Initialized Values" and the array.
  • Use a loop to ask the user to enter the cost of each building. Store these values in the array.
  • Call the generic method Print passing it "Building Costs" and the array.

Main File - Class ArrayListGenerics

  • Create an ArrayList to hold the values of Building Cost (currency: $)
  • Use a loop to ask the user to enter the cost of the building. Use a sentinel value to end the loop. Store each value entered in the ArrayList.
  • Display a description and the value of the 1st element in the ArrayList.
  • Display a description and the value of the last element in the ArrayList.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!