Java代写 | CS145 – PROGRAMMING ASSIGNMENT CARD HEAP GUI

本次作业是实现一个堆数据结构应用在卡片实体类上,并通过GUI显示,语言是java

CS145 – PROGRAMMING ASSIGNMENT
CARD HEAP GUI
MORE WITH CARDS
OVERVIEW
This program focuses on heaps and using the GUI.
INSTRUCTIONS
Turn in Card.java, CardHeap.java and your main file. You are allowed to reuse your
Card.java from a prior assignment with any necessary changes that you want to add.
IMPLEMENTATION DETAILS:
You will reuse your Card.java file and you will write the GUI form and the
CardHeap.java files to implement the necessary behavior.
THE PROGRAM
In this assignment, you will implement a simple GUI program that will randomly
add/remove cards that are the same as the ones we used in assignment #7 to a heap.
(Note that we will be ignoring the premium cards, although they should still work.).
Your program should look like the following at the beginning:
After a few adds:
After a few rounds of adding and removal:
After a clear:
THE MAIN PROGRAM
The GUI/main program should do the following:
 The add button should create a random card(default constructor) and then add it
to the heap.
 Pop should remove the smallest card from the heap.
o It should then print the removed card in the label marked Last Removed
 Clear should set the heap to empty.
 Every time you press a button it should reset the top label to the toString()
representation of the storage heap. In other words keep the labels updated.
 When the program starts, the 2nd label can be blank if you want.
CARD
The only significant change that you should do to the Card class is that you should modify the
toString() method to print off the power, toughness, and the cost if you haven’t done so already.
So Instead of [57/732] it should print off [57/732:28] instead.
THE HEAP
The heap should be a stored in an Array of Cards. I would not suggest trying to make a generic
heap. You can use the PowerPoint/book as a guide on how to write it.
The methods you will need are:
 void add(Card x)
 Card remove()
 void clear()
 private void expand()
 String toString()
o Only print the used part of the array, do not print the entire storage array.