Question: in java Coin Sorting Machine Write a java class called CoinStack.java, which implements CoinStackInterface Write your application named CoinStackApp.java that read coins (three data files

in java

Coin Sorting Machine 
  1. Write a java class called CoinStack.java, which implements CoinStackInterface
  2. Write your application named CoinStackApp.java that read coins (three data files are provided for testing purpose): Construct 4 stacks (for penny, nickel, dime, and quarter stack), read coins from the data file then push to their corresponding stacks. For example, if the value is 10, then you need to push that coin to dime stack.
  3. The print the four coin stacks as shown below. Hint: You may implement and use the method as spcified below: public static void print(CoinStack[] cs)

in java Coin Sorting Machine Write a java class called CoinStack.java, which

Given files:

Coin.java

public class Coin{ int value; Coin next; public Coin(int value){ this.value=value; } public void setLink(Coin coin){ this.next=coin; } public Coin getLink(){ return next; } public int getValue(){ return value; } }

coins.txt

implements CoinStackInterface Write your application named CoinStackApp.java that read coins (three data

coins2.txt

5 10 25 1 10 1 25 1 10 25 1 5 10 10 10 10 10 1 1 5 25 25 25 10 10 5 25 1 10 1 1 5 1 25 10 25 25 1 25 10 5 10 25 25 10 25 10 5

coins3.txt

5 25 10 25 5 25 5 5 5 5 10 5 10 5 10 1 10 5 25 5 10 25 10 1

CoinStackInterface.txt

//you do not need this file, you shold be able to figure out //what methods to implements. If you do not know how to do it, //please ask me in class. public interface CoinStackInterface{ void pop(); void push(Coin coin); Coin top(); boolean isEmpty(); }

.

Here is a sample output: III IIII | | | |----- | | |----- ---- | | | | | | |---- |---- |||||||||| ! ! ! ! ! ! ! |----- |----- |----- ----- ----- ---- ---- ---- ---- ---- ------ ------ ---- ------ ------ 15 10 25 110 1 25 1 10 25 15 10 10 10 10 10 115 25 25 25 19 10 5 25 1 10 11515 10 225 25 1 25 10 510 25 25 10 510 55 510 5555555 10 5105 10 110 5255 10 25 10 15 251 25 10 5 10 1255511 10 51 25 25 15 10 15 15 10 10 1 Here is a sample output: III IIII | | | |----- | | |----- ---- | | | | | | |---- |---- |||||||||| ! ! ! ! ! ! ! |----- |----- |----- ----- ----- ---- ---- ---- ---- ---- ------ ------ ---- ------ ------ 15 10 25 110 1 25 1 10 25 15 10 10 10 10 10 115 25 25 25 19 10 5 25 1 10 11515 10 225 25 1 25 10 510 25 25 10 510 55 510 5555555 10 5105 10 110 5255 10 25 10 15 251 25 10 5 10 1255511 10 51 25 25 15 10 15 15 10 10 1

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!