(Solved) : Write Class Called Shoejava Shoejava Three Instance Variables String Brand Cannot Blank Do Q42761759 . . .

You will write a class called Shoe.java

Shoe.java should have

Three instance variables

  • String brand (cannot be blank)
  • double size (from 5 to 12)
  • int color (a number from 1 to 5 representing one of 5 colors)This code is to control the amount of colors. the colorsrepresented are as follows
    • 1. red
    • 2. green
    • 3. blue
    • 4. black
    • 5. grey

One constructor, one get method per instance variable, one setmethod per instance variable. You will need a toString method thatwill return a string with the shoe information.

  • Total for this class is 170 points + style 30 points =200 points
  • constructor (25 points)
  • Each set method is 20 points
  • setBrand
  • setSize
  • setColor <— uses an integer to set the color, must be likethis: private void setColor(int color)
  • Each get Method is 20
  • getBrand
  • getSize
  • getColor <— even when the color is a number the getColormay return a string or a number. Any way you decide to do itit should run properly with my code and with any othercode that may use this class
  • The toString method is 25 points
  • toString <– should spell the color. It should not print thecolor number.

Keep in mind that in order for this to work you will need tocreate ShoeException.java as well.


Total points for this class is 60 for the methods + 20 for stylefor a total of 80 points

  • constructor (20 points)
  • setMessage (20 points)
  • getMessage (20 points)

The code below can be used to test that your class works well.Copy and paste it into JGrasp in a file to be namedShoeStore.java The code below should run with yourcode. I have tested it with my own homework code and it works well.the last 40 points will be earned depending on howwell your code interacts with the given code below.

import java.util.*;
public class ShoeStore{

   public static void main(String arg[ ]) throwsException{

      Scanner sc = newScanner(System.in);
      double size=0;
      String brand = “”;
      int color=0;
      boolean exit = false;
      final int ASIZE = 3;
      Shoe sh = null;
        System.out.print(“Enter shoe brand: “);
         brand =sc.nextLine( );
         sc = newScanner(System.in); //resetting the scanner
        System.out.print(“Enter size from 5 to 12: “);
         size =sc.nextDouble( );
         sc = newScanner(System.in);
        System.out.println(“Enter color as a number from 1 to 5: “);
        System.out.print(“color: “);
         color =sc.nextInt( );
         sc = newScanner(System.in);
        System.out.println( );
           sh = new Shoe(brand, size, color);
        catch(ShoeException se){
           System.out.println(“Error in creating the shoe”);
           System.out.println(se.getMessage( ));
           sc = new Scanner(System.in); //resetting the scanner
      } //ends inner try
        System.out.println(“you did not enter a number for either size orcolor”);
         sc = newScanner(System.in);
   } //main method
}   //class

Expert Answer

Answer to You will write a class called Shoe.java Shoe.java should have Three instance variables String brand (cannot be blank) do…

Leave a Comment


We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?