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

2. The Showy Shiny Shoe Store sells different styles of shoes, such as sandals a

ID: 3869746 • Letter: 2

Question

2.     The Showy Shiny Shoe Store sells different styles of shoes, such as sandals and walking shoes. Each style of shoe is offered in different colors, such as brown and black. Available shoe sizes range from size 5 to size 11, in both whole and half sizes. Design an object-oriented computer program by doing the following:

a.      Create the class diagram and pseudocode for the Shoes class that contains the style of the shoes, the color of the shoes, and the size. Examples of valid values for the style are "sandals" and "walking". Examples of valid values for the color are "brown" and "black". Examples of valid values for the size are 6.5 and 9.0. Be sure to choose the most appropriate data type for the attributes. For this class definition, include the following:

                        i.          A default constructor that initializes each attribute to some reasonable default value for non-existent shoes.

                      ii.          Another constructor method that has a parameter for each data member. This constructor initializes each attribute to the value provided when an object of this type is instantiated.

                    iii.          Accessor and mutator methods for each attribute.

                     iv.          A method that displays all the data about the shoes.

b.     Add a class diagram for the application to the one you created for part a above, add the correct relationship and multiplicity, and insert the completed diagram immediately before the pseudocode for this problem in the Word document. Write the pseudocode for the application program for the shoe store with a main() module that instantiates two objects of the Shoes class. The first object should be named nerdShoes and use the default constructor. The second object should be named coolShoes and use the second constructor to initialize the style to "sandals", the color to "brown", and the size to 8.5. Include the following instructions in the main() method, in the order specified below:

                        i.          A call to set the color of the nerdShoes to "tan".

                      ii.          A call to set the style of the nerdShoes to “walking”.

                    iii.          A call to set the size of the nerdShoes to 9.5.

                     iv.          A statement that displays the style of the nerdShoes, using the appropriate method call.

                       v.          A call to change the color of the coolShoes to "purple".

                     vi.          A statement that displays the style of the coolShoes, using the appropriate method call.

                   vii.          A call for the coolShoes object to the method that displays all the information about the shoes.

Explanation / Answer

package theshowyshinyshoestore;

public class Shoe {

String style;

float size;

String color;

public Shoe() {

      setStyle("unknown");

      setSize(0);

      setColor("unknown");

}

public Shoe(String style, float size, String color) {

      setStyle(style);

      setSize(size);

      setColor(color);

}

public void setStyle( String style ) {

      this.style = style;

}

public void setSize( float size ) {

      this.size = size;

}

public void setColor( String color ) {

      this.color = color;

}

public String getStyle() {

    return this.style;

}

public float getSize() {

    return this.size;

}

public String getColor() {

    return this.color;

}

public String toString() {

    return "Style: " + this.style + " Size: " + this.size + " Color: " + this.color;

}

public static void main(String[] argv) {

    Shoe nerdShoes = new Shoe();

    Shoe coolShoes = new Shoe("sandals", 8.5f, "brown");

    System.out.println( "nerdShoes: " + nerdShoes );

    System.out.println( "coolShoes: " + coolShoes );

    nerdShoes.setColor("tan");

    nerdShoes.setStyle("walking");

    nerdShoes.setSize(9.5f);

    coolShoes.setColor("purple");

    System.out.println( "nerdShoes: " + nerdShoes );

    System.out.println( "nerdShoes style: " + nerdShoes.getStyle() );

    System.out.println( "coolShoes style: " + coolShoes.getStyle() );

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote