Question: All the files are using inheritance they do not need any changes the only file that needs to be coded is the CardGui. It needs

 All the files are using inheritance they do not need anychanges the only file that needs to be coded is the CardGui.It needs to print a deck of cards all arranged in agui output along with the console ouput I can provided limited fileshere So I have provided the best I could. The output pictureI have added as well for what I am looking for andI will rate this answer if it works along with many others! If I could just copy past it I would but cheggdoes not let the files be posted saying it is too long.0.11+ import java.awt.*;. 15 16 public class CardGui { 17 18 publicstatic void main(String[] args) { 19 CardDeck deck = new CardDeck(); 2021 22 23 24 } } 1 2 package Myfiles; 3 4

All the files are using inheritance they do not need any changes the only file that needs to be coded is the CardGui. It needs to print a deck of cards all arranged in a gui output along with the console ouput I can provided limited files here So I have provided the best I could. The output picture I have added as well for what I am looking for and I will rate this answer if it works along with many others ! If I could just copy past it I would but chegg does not let the files be posted saying it is too long.

import java.util.Iterator; 5 6 public class ABList implements ListInterface { 7 protected

0.11+ import java.awt.*;. 15 16 public class CardGui { 17 18 public static void main(String[] args) { 19 CardDeck deck = new CardDeck(); 20 21 22 23 24 } } 1 2 package Myfiles; 3 4 import java.util.Iterator; 5 6 public class ABList implements ListInterface { 7 protected final int DEFCAP = 100; // default capacity 8 protected int origCap; // original capacity 9 protected T[] elements; // array to hold this list's elements 10 protected int numElements = 0; // number of elements in this list 11 12 // set by find method 13 protected boolean found; // true if target found, otherwise false protected int location; // indicates location of target if found 15 16e public ABList() { 17 elements = (T(1) new Object[DEFCAP]; origCap = DEFCAP; 19 } 14 18 20 public ABList(int origCap) { elements = (1/1) new Object[origCap]; this.origCap = origCap; } 21 22 23 24 25 26 27 28 29 30 31 32 33 340 35 protected void enlarge). T[] larger = (1/1) new Object[elements.length + origCap]; for (int i = 0; i implements Iterator { 11 private ABList theList; 12 private int previous Pos = -1; 13 140 public ABListIterator (ABList target) { 15 theList = target; 16 } 17 18 public boolean hasNext() 19 // Returns true if the iteration has more elements; otherwise returns false. 20 { 21 return (previous Pos = size())) throw new IndexOutOfBoundsException("Illegal index of " + index + " passed to ABList get method. "); return elements[index]; } public int indexOf(T target) { find(target); if (found) return location; else return -1; } public T remove(int index) { if ((index = size())) throw new IndexOutOfBounds Exception("Illegal index of " + index + " passed to ABList remove method. "); A129 130 131 132 133 134 135 136 A1370 138 139 140 141 142 143 144 145 A146 147 148 149 150 151 152 153 154 155 156 157 158 41590 160 1610 162 163 A1640 165 166 167 168 A1699 170 171 T hold = elements[index]; for (int i = index; i iterator) { return new Iterator() { private int previousPos = -1; public boolean hasNext() { return (previousPos { 130 public enum Rank { 14 Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace 15 } 16 170 public enum Suit { 18 Club, Diamond, Heart, Spade 19 } 20 21 protected final Rank rank; 22 protected final Suit suit; 23 protected ImageIcon image; 24 250 Card(Rank rank, Suit suit, ImageIcon image) { 26 this.rank = rank; 27 this.suit = suit; 28 this. image = image; 29 } 30 310 public Rank getRank() { 32 return rank; 33 } 34 35e public Suit getSuit() { 36 return suit; 37 } 38 390 public ImageIcon getImage() { 40 return image; 41 } 42 430 @Override 144 public boolean equals(Object obj) 45 // Returns true if 'obi' is a Card with same rank 46 // as this Card, otherwise returns false. 47 { 48 if (obj == this) 48 49 50 51 if (obj == this) return true; else if (obj == null || obj.getClass() != this.getClass()) return false; else { Card c = (Card) obj; return (this.rank == c.rank); 52 53 54 55 } 56 57 } 580 59 60 61 62 63 64 65 660 67 68 69 public int compareTo(Card other) // Compares this Card with 'other' for order. Returns a // negative integer, zero, or a positive integer as this object // is less than, equal to, or greater than 'other'. { return this.rank.compareTo(other.rank); } @Override public String toString() { return suit + " " + rank; } 70 71 // public static Comparator bridgeComparator() { 72 // return new Comparator() { 73 // public int compare (Card c1, Card c2) { 174 // return (c1.getSuit().ordinal() * 13 + c1.getRank().ordinal()) - 75 // (c2.getSuit().ordinal() * 13 + c2.getRank().ordinal()); 76 // } 77 // }; 78 // } 79 } 899 Chapter 5 2 // Collection Interface.java by Dale/Joyce/Weems 3 // 4 // Interface for a class that implements a collection of T. 5 // A collection allows addition, removal, and access of elements. 6 // 7 // Nullelements are not allowed. Duplicate elements are allowed. 8 // - 9 10 package Myfiles; 11 12 public interface Collection Interface 13 { 14 boolean add(t element); 15 // Attempts to add element to this collection. 16 // Returns true if successful, false otherwise. 17 18 T get(i target); 19 // Returns an element e from this collection such that e.equals(target). 20 // If no such e exists, returns null. 21 22 boolean contains (T target); 23 // Returns true if this collection contains an element e such that 24 Il e.equals(target); otherwise returns false. 25 26 boolean remove (T target); 27 // Removes an element e from this collection such that e.equals(target) 28 // and returns true. If no such e exists, returns false. 29 30 boolean isFull(); 31 // Returns true if this collection is full; otherwise, returns false. 32 33 boolean isEmpty(); 34 // Returns true if this collection is empty; otherwise, returns false. 35 36 int size(); 37 // Returns the number of elements in this collection. 38 } 39 26 27 28 13 214 import java.util.*; 15 16 public interface ListInterface extends Collection Interface, Iterable { 17 void add(int index, T element); 18 // Throws IndexOutOfBounds Exception if passed an index argument 19 // such that index size(). 20 // Otherwise, adds element to this list at position index; all current 21 // elements at that position or higher have 1 added to their index. 22 // Optional. Throws UnsupportedoperationException if not supported. 23 24 I set(int index, T newElement); 25 // Throws IndexOutOfBounds Exception if passed an index argument // such that index = size(). // Otherwise, replaces element on this list at position index with // newElement and returns the replaced element. 29 // Optional. Throws UnsupportedOperationException if not supported. 30 31 T get(int index); 32 // Throws IndexOutOfBounds Exception if passed an index argument // such that index = size(). 34 // Otherwise, returns the element on this list at position index. 35 36 int indexOf(T target); 37 // If this list contains an element e such that e.equals(target), 38 // then returns the index of the first such element. 39 // Otherwise, returns -1. 40 41 I remove(int index); 42 // Throws IndexOutOfBoundsException if passed an index argument 43 // such that index = size(). 44 // Otherwise, removes element on this list at position index and 45 // returns the removed element; all current elements at positions 46 // higher than index have 1 subtracted from their position. 47 } 48 33 Your program will output the 52 cards in both GUI and CLI (i.e. text) format. Sample GUI Output: Bridge Hands GUI 9 CULTY wwwww OT 0.11+ import java.awt.*;. 15 16 public class CardGui { 17 18 public static void main(String[] args) { 19 CardDeck deck = new CardDeck(); 20 21 22 23 24 } } 1 2 package Myfiles; 3 4 import java.util.Iterator; 5 6 public class ABList implements ListInterface { 7 protected final int DEFCAP = 100; // default capacity 8 protected int origCap; // original capacity 9 protected T[] elements; // array to hold this list's elements 10 protected int numElements = 0; // number of elements in this list 11 12 // set by find method 13 protected boolean found; // true if target found, otherwise false protected int location; // indicates location of target if found 15 16e public ABList() { 17 elements = (T(1) new Object[DEFCAP]; origCap = DEFCAP; 19 } 14 18 20 public ABList(int origCap) { elements = (1/1) new Object[origCap]; this.origCap = origCap; } 21 22 23 24 25 26 27 28 29 30 31 32 33 340 35 protected void enlarge). T[] larger = (1/1) new Object[elements.length + origCap]; for (int i = 0; i implements Iterator { 11 private ABList theList; 12 private int previous Pos = -1; 13 140 public ABListIterator (ABList target) { 15 theList = target; 16 } 17 18 public boolean hasNext() 19 // Returns true if the iteration has more elements; otherwise returns false. 20 { 21 return (previous Pos = size())) throw new IndexOutOfBoundsException("Illegal index of " + index + " passed to ABList get method. "); return elements[index]; } public int indexOf(T target) { find(target); if (found) return location; else return -1; } public T remove(int index) { if ((index = size())) throw new IndexOutOfBounds Exception("Illegal index of " + index + " passed to ABList remove method. "); A129 130 131 132 133 134 135 136 A1370 138 139 140 141 142 143 144 145 A146 147 148 149 150 151 152 153 154 155 156 157 158 41590 160 1610 162 163 A1640 165 166 167 168 A1699 170 171 T hold = elements[index]; for (int i = index; i iterator) { return new Iterator() { private int previousPos = -1; public boolean hasNext() { return (previousPos { 130 public enum Rank { 14 Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace 15 } 16 170 public enum Suit { 18 Club, Diamond, Heart, Spade 19 } 20 21 protected final Rank rank; 22 protected final Suit suit; 23 protected ImageIcon image; 24 250 Card(Rank rank, Suit suit, ImageIcon image) { 26 this.rank = rank; 27 this.suit = suit; 28 this. image = image; 29 } 30 310 public Rank getRank() { 32 return rank; 33 } 34 35e public Suit getSuit() { 36 return suit; 37 } 38 390 public ImageIcon getImage() { 40 return image; 41 } 42 430 @Override 144 public boolean equals(Object obj) 45 // Returns true if 'obi' is a Card with same rank 46 // as this Card, otherwise returns false. 47 { 48 if (obj == this) 48 49 50 51 if (obj == this) return true; else if (obj == null || obj.getClass() != this.getClass()) return false; else { Card c = (Card) obj; return (this.rank == c.rank); 52 53 54 55 } 56 57 } 580 59 60 61 62 63 64 65 660 67 68 69 public int compareTo(Card other) // Compares this Card with 'other' for order. Returns a // negative integer, zero, or a positive integer as this object // is less than, equal to, or greater than 'other'. { return this.rank.compareTo(other.rank); } @Override public String toString() { return suit + " " + rank; } 70 71 // public static Comparator bridgeComparator() { 72 // return new Comparator() { 73 // public int compare (Card c1, Card c2) { 174 // return (c1.getSuit().ordinal() * 13 + c1.getRank().ordinal()) - 75 // (c2.getSuit().ordinal() * 13 + c2.getRank().ordinal()); 76 // } 77 // }; 78 // } 79 } 899 Chapter 5 2 // Collection Interface.java by Dale/Joyce/Weems 3 // 4 // Interface for a class that implements a collection of T. 5 // A collection allows addition, removal, and access of elements. 6 // 7 // Nullelements are not allowed. Duplicate elements are allowed. 8 // - 9 10 package Myfiles; 11 12 public interface Collection Interface 13 { 14 boolean add(t element); 15 // Attempts to add element to this collection. 16 // Returns true if successful, false otherwise. 17 18 T get(i target); 19 // Returns an element e from this collection such that e.equals(target). 20 // If no such e exists, returns null. 21 22 boolean contains (T target); 23 // Returns true if this collection contains an element e such that 24 Il e.equals(target); otherwise returns false. 25 26 boolean remove (T target); 27 // Removes an element e from this collection such that e.equals(target) 28 // and returns true. If no such e exists, returns false. 29 30 boolean isFull(); 31 // Returns true if this collection is full; otherwise, returns false. 32 33 boolean isEmpty(); 34 // Returns true if this collection is empty; otherwise, returns false. 35 36 int size(); 37 // Returns the number of elements in this collection. 38 } 39 26 27 28 13 214 import java.util.*; 15 16 public interface ListInterface extends Collection Interface, Iterable { 17 void add(int index, T element); 18 // Throws IndexOutOfBounds Exception if passed an index argument 19 // such that index size(). 20 // Otherwise, adds element to this list at position index; all current 21 // elements at that position or higher have 1 added to their index. 22 // Optional. Throws UnsupportedoperationException if not supported. 23 24 I set(int index, T newElement); 25 // Throws IndexOutOfBounds Exception if passed an index argument // such that index = size(). // Otherwise, replaces element on this list at position index with // newElement and returns the replaced element. 29 // Optional. Throws UnsupportedOperationException if not supported. 30 31 T get(int index); 32 // Throws IndexOutOfBounds Exception if passed an index argument // such that index = size(). 34 // Otherwise, returns the element on this list at position index. 35 36 int indexOf(T target); 37 // If this list contains an element e such that e.equals(target), 38 // then returns the index of the first such element. 39 // Otherwise, returns -1. 40 41 I remove(int index); 42 // Throws IndexOutOfBoundsException if passed an index argument 43 // such that index = size(). 44 // Otherwise, removes element on this list at position index and 45 // returns the removed element; all current elements at positions 46 // higher than index have 1 subtracted from their position. 47 } 48 33 Your program will output the 52 cards in both GUI and CLI (i.e. text) format. Sample GUI Output: Bridge Hands GUI 9 CULTY wwwww OT

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!