Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java and please do the first picture and run with the codes below and test codes thank you! public class Shape List private static final
Java and please do the first picture and run with the codes below and test codes thank you!
public class Shape List private static final int DEFAULT_SIZE = 2; private Shape [] elements; private int count; public ShapeList() { // TODO: initialize the fields elements = new Shape [DEFAULT_SIZE] ; count = 0; // elements should be initialized as an empty // array that holds DEFAULT_SIZE shapes } * Purpose: returns the number of elements in list Parameters: none * Returns: int - the number of elements public int size() { return count; Purpose: adds Shape s to back of this list Parameters: Shape * Returns: nothing - S public void add (Shape s) { // TODO } * Purpose: returns a String reprensentation of the elements in this list separated by newlines * Parameters: none * Returns: String - the representation * public String toString() { String s = "List contents:"; for (int i = 0; iStep 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