Question
Can anyone did this for me please and explain the code. I know it a lot but please help me. This will be written in
Can anyone did this for me please and explain the code. I know it a lot but please help me. This will be written in the java language.
Coin Class
Coin Purse
My Purse
1. Look over the Coin class to see what it is doing. (has constructor for a coin with two parts: name and value)
2. Look at CoinPurse (think of this class as a big jar filled with coins) This class contains methods to allow us to do things with and to our coins. You need to write these methods.
3. Look at MyPurse. This is the tester class. Here you need to create at least 7 coins, add the 7 coins to the ArrayList then create three lines of output:
a. the total # of coins
b. the total value of these coins
c. what each coin is (a list of 7 names, ex. nickel, penny, penny, quarter, nickel.......)
*The coin class represents a coin obiect which will be stored in a Coin Purse. public class coin // instance var.ables private final in value; privale final storing vName; Constructor for objects of clasa Coin public coin tint valy if (val -- 11 value - val; vName - "PENNY": 1 else if (va. -- 5) 1 value - val; vName = "NICKEL"; 1 else if (val == 10) { value = val; Name - "DIME" 1 else if (val -- 25) value - val; Name - "QUARTER" ; ) else if (va. -- 50) value - vali vName - "EALF DOLLAR"; else if (va. -- 100) 1 value - vali vName = "DOLLAR"; else 1 value - 0 Name - null; 1 + returns the value of this Coin public int gelValue() return this.value; public String toString() return VN : public vod add oia Coin o! import java.util.ArrayList; HA a Cainurse holds a collection of Cain objet. public clasa CoinBuree ArrayListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started