title: Java - User input in a main method and calling setters to main
body: <p>This is my assignment if you want to read it:</p>
  
  <p>Create a NetBeans project. Create a Java file for EACH of the three classes. For example, add to your project a new file calledBook.java   and then create the new class from scratch in that file. Use your UML diagrams as the guideline for writing the code. The variables and methods from the diagrams will be part of each of your classes. Make sure ALL your variables are declared to be private.Protect Your Data!Objects store data or information! When variables are declared private you can protect or guard that information like a Pit Bull protects a piece of meat. Never allow bad data to be stored in your objects!In each 'set' method, make sure the value passed to the method is in range, greater than or equal to the minimum and less than or equal to the maximum. For strings,you may check the length of the string. Each 'set' method should have some sort of 'if-else' statement, assign the data when it is good and print an informative message when an incorrect value is passed. The Shoe class setSize() method would assign the value '10' to the size global variable when it is passed to the method. But, it would print a 'Shoe size must be between 1 and 15' and NOT change the global variable when a value such as '437' was passed to the method. The private variable declarations build a wall around your data, and the 'set' methods are the gates that allow only 'good' information in. Your constructor that assigns values to global variables should use the 'set' methods so you DO NOT have to repeat the same checks in the constructor. The constructor with NO parameters can go ahead and directly set the default values into the global variables.Test Next For each class, create a main method that will declare, build and use an object of that class. So the Book.java   main will declare, build and use a Book object, and the other two classes will do the same. Use a command line interface and ask the user to input a value for EACH global variable. Call a constructor or the set methods and insert that information into the object. Once the data is inserted use the object to call the toString method
  and print the object to the console. You will be writing THREE main methods, one for each class. When you test, make sure your set methods DO NOT allow bad data into the object. Try to make it fail, see if you can sneak bad values into the variables.To insure you complete each class, use this checklist:_____  Three global variables (not the same type)_____  Two constructor methods_____  Three 'get' methods_____  Three 'set' methods_____  One 'toString' method_____  One main method that creates an object, assigns values, and prints the object</p>
  
  <p>My issue with this is that I have all that is needed except for the user input which i am not sure where to put as well as where to call the set methods because i am not sure how to call those methods in my main. Any help would be greatly appreciated.</p>
  
  <p>This is what I have so far for the first shoe class:</p>
  
  <pre><code> public class Shoe {
  
  private String brand;
  private String color;
  private int size;
  public Shoe() { 
  
  }
  //every setter should have one check
  public Shoe(int size, String brand, String color) {
      this.color = color;
      this.brand = brand;
      this.size = size;
  
  }
  
  public int getSize() {
      return size;
  }
  
  public void setSize(int size) {
   this.size = size;
      if(size&lt;1 || size&gt;20){
          System.out.println("Invalid");
      }
  
  }
  
  public String getBrand() {
      return brand;
  }
  
  public void setBrand(String brand) {
      this.brand = brand;
      if (brand.length()&gt;20 || brand.length()&lt;3)
          System.out.println("Invalid Name");
  }
  
  public String getColor() {
      return color;
  }
  
  public void setColor(String color) {
      this.color = color;
      if (color.length()&gt;15 || color.length()&lt;3)
          System.out.println("Invalid Color");
  }
  
        @Override
     public String toString(){
  return "size is " + this.size + " \nbrand is " + this.brand + " \ncolor is " 
      + this.color;
  
  
      }
        public static void main(String[] args){
       Shoe s = new Shoe();
       System.out.println(s.toString());
   }
  </code></pre>
  
  <p>}   </p>