Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Grade This exam totals to 100 points. Follow the instructions. Good luck! Chapte

ID: 3703731 • Letter: G

Question

Grade This exam totals to 100 points. Follow the instructions. Good luck! Chapter 5 and 6 (Big Long Question) (60 pts) 1. Create a class Shoe to be used in a used shoe record keeping system. It has the following: a. Instance variables i. brandName- The brand of shoe. ii. length - A positive whole number between 5 and 16 inclusively. iii. width - Can only be the values "A, B, C, D, E, EE" b. Two constructors i. ii. Default - set the instance variables to a correct default value One that takes in three parameters that will set the instance variables while also checking values. c. Accessors and Mutators for all instance variables. For Mutators, Make sure to check for invalid values as described in the instance variable section. i. d. A method printlnfo that returns nothing, and prints the attributes in the e. A method equals which takes in another instance of a Shoe and returns f. A static method duplicateShoe which takes in an instance of a Shoe, listed order from part "a" true of false depending if the attributes of the other Shoe are equal. creates a new instance of a Shoe with the same properties as the given shoe, and returns the new instance of that shoe.

Explanation / Answer

public class Shoe {

   private String brandName;

   private int length;

   private String width;

   Shoe() {

       brandName = "WoodLands";

       length = 13;

       width = "E";

   }

   Shoe(String bName, int l, String width) {

       brandName = bName;

       length = l;

       this.width = width;

   }

   public String getBrandName() {

       return brandName;

   }

   public void setBrandName(String brandName) {

       this.brandName = brandName;

   }

   public int getLength() {

       return length;

   }

   public void setLength(int length) {

       this.length = length;

   }

   public String getWidth() {

       return width;

   }

   public void setWidth(String width) {

       this.width = width;

   }

   public void printInfo() {

       System.out.println("brandName=" + brandName + ", length=" + length + ", width=" + width);

   }

   @Override

   public boolean equals(Object obj) {

       if (this == obj)

           return true;

       if (obj == null)

           return false;

       if (getClass() != obj.getClass())

           return false;

       Shoe other = (Shoe) obj;

       if (brandName == null) {

           if (other.brandName != null)

               return false;

       } else if (!brandName.equals(other.brandName))

           return false;

       if (length != other.length)

           return false;

       if (width == null) {

           if (other.width != null)

               return false;

       } else if (!width.equals(other.width))

           return false;

       return true;

   }

   public static Shoe duplicateShoe(Shoe s) {

       Shoe shoe = new Shoe(s.brandName, s.length, s.width);

       return shoe;

   }

}


=================================
Thanks, Let me know if there is any concern.

PLEASE UPVOTE if it helped