Question: I'm using BlueJ and the code is in Java. This lab requires you to create three classes, Purse, Coin, and Purse Tester. The Purse class

 I'm using BlueJ and the code is in Java. This lab

I'm using BlueJ and the code is in Java.

This lab requires you to create three classes, Purse, Coin, and Purse Tester. The Purse class manages a set of Coin objects in an array of Coin that has a max size of 10. The Purse Tester class contains main0 and is the controlling class of the application. Coin: The Coin class has two instance ficlds (name: String, value: double). Provide get and set methods for each field. Two constructors for a Coin should be provided including a no-arg constructor which defaults name-"PENNY" and value-0.01, and a Coin constructor that accepts in a name and a value. Purse: The Purse class maintains a collection of Coin objects using a Coin[l of max size of 10. A class constant MAX should be included that has a valuc of 10. Recall that a class constant is defined as static final. An error message should be provided if an attempt is made to add more entries into the array than MAX. A data field called coinCnt should maintain the current number of elements in the array. The following methods should be provided for Purse +Purse() //initializes the coin[] a size of MAX +add(e: Coin) ivoid //adds a coin object to the list +sum () :double //returns the total value of all of the coins in the 1ist +maxValue ) :double Wreturns the value of the coin with the highest value tmaxcoin (0 :Coin //returns the Coin object that has the max value tremove (name: String)void /removes a Coin from the list based on name Print O ivoid 7/prints list Hints: When removing a coin you need to find the last coin in the list and "move it" to the location that you of the coin that you wish to delete and then reduce the value of size by one: coins:data DIME 0.10 NICKEL 0.05 PENNY 0.01 PENNY D.01 QUARTER 0.25 DIME 0-10 The Puraetester has enain method that shoutd do the toslowing items in this order. e Pzint your name and lab number . create Purse 9 yPUre . Load myPurse with the coins An coins.data .Print the contentsl lot myPusn . Print mycoininaxvalve . Print nane and valpe of ax coin . remove a penny * Add two dines . Print the contenta or nyPa * Print progran ternanaton message pload your source Files Coanova your generated output as allext ortextile. Thss should be placed in Puxse.java and PurseTester java. Upload Assignment 2 Dropbox. Include your name, lab #, and date at the top of your

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!