Question: Done in java Task #1 Store coin data in an ArrayList (10 pts) Create a Coin class that represents each coin information with attributes inside
Done in java
Task #1 Store coin data in an ArrayList (10 pts)
- Create a Coin class that represents each coin information with attributes inside { and } in the coins.txt file. Make sure that all fields are private and use getter and setter methods to access and modify the fields of Coin.
- Create another class named StoreCoinArrayList class. You do not create the main method in the StoreCoinArrayList.
- Edit StoreCoinArrayList and create ArrayList field, which can hold Coin type data.
private ArrayList list = new ArrayList();
- You need to use your homework 1 code in a method inside StoreCoinArrayList to read coin data from coins.txt file, and then create a Coin Object for each coin and add created coins to ArrayList when the constructor is called for StoreCoinArrayList.
- Then, write four methods called findMin, findMax, searchName, and size in StoreCoinArrayList.
- findMin method takes priceType as String and returns the Coin with the minimum price for the given type in the list.
- findMax method takes priceType as String and returns the Coin with the maximum price for the given type in the list.
- searchName method takes a name as String and returns true or false whether the name of the Coin exists in the list.
- size method returns int that shows how many Coin in the list.
- Use the Junit test to test your four methods of StoreCoinArrayList are correct for different cases.
Coins.txt file link: 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
Get step-by-step solutions from verified subject matter experts
