Question: Done in java Task #2 Store coin data in an Array (10 pts) Create another class named StoreCoinArray class. You do not create the main

Done in java

Task #2 Store coin data in an Array (10 pts)

  1. Create another class named StoreCoinArray class. You do not create the main method in the StoreCoinArray.
  2. Edit StoreCoinArray and create Array field, which can hold Coin type data.

private Coin [] array = new Coin[50];

  1. You need to use your homework 1 code in a method inside StoreCoinArray to read coin data from coins.txt file, and then create a Coin Object for each coin and add created coins to the array when the constructor is called for StoreCoinArray. As you can see, the initial size of the array is 50. You need to increase the size of array by adding 100 more as much as you need.
  2. Then, write four methods called findMin, findMax, searchName, and size in StoreCoinArray.
    1. findMin method takes priceType as String and returns the Coin with the minimum price for the given type in the array.
    2. findMax method takes priceType as String and returns the Coin with the maximum price for the given type in the array.
    3. searchName method takes a name as String and returns true or false whether the name of the Coin exists in the array.
    4. size method returns int that shows how many Coin in the array.

  1. Use the Junit test to test your four methods of StoreCoinArray are correct for different cases.

https://learn-us-east-1-prod-fleet02-xythos.content.blackboardcdn.com/5cd03868094b1/7953000?X-Blackboard-Expiration=1612839600000&X-Blackboard-Signature=DxiaySlQhgCl79gyDvJcepSUWLFGfJKwWuUb8T6giOY%3D&X-Blackboard-Client-Id=200124&response-cache-control=private%2C%20max-age%3D21600&response-content-disposition=inline%3B%20filename%2A%3DUTF-8%27%27coins%25281%2529.txt&response-content-type=text%2Fplain&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210208T210000Z&X-Amz-SignedHeaders=host&X-Amz-Expires=21600&X-Amz-Credential=AKIAZH6WM4PL5SJBSTP6%2F20210208%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=ac9bb205d67ac35c38866846f37ab83803844155afb276f58ea5b67a66e8bb8f

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!