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

I have a java program that is due tomorrow and I cant get itto work because it d

ID: 3617370 • Letter: I

Question

I have a java program that is due tomorrow and I cant get itto work because it doesn't have a main method. Please help me. Hereis the program: class Animal {
       private String type;
      
       public Animal (Stringtype){
             this.type =type;
   }
    public String getAnimalName(){
           Stringst = "This is a";
          return (st +type);
   }
}
I have a java program that is due tomorrow and I cant get itto work because it doesn't have a main method. Please help me. Hereis the program: class Animal {
       private String type;
      
       public Animal (Stringtype){
             this.type =type;
   }
    public String getAnimalName(){
           Stringst = "This is a";
          return (st +type);
   }
}

Explanation / Answer

import java.util.Scanner; public class Animal {     private String type;     public Animal (String type){         this.type =type;    }     public String getAnimalName(){         String st = "This is a";         return (st + type);    }     public static void main(String[] args) {                 //making object of scanner class for takinginput         Scanner input = newScanner(System.in);                //taking input from user and save in Stringobject         String yourAnimalName=input.nextLine();                 //Making Object of Animal Class         Animal yourAnimal = newAnimal(yourAnimalName);                //printing Animal name by callinggetAnimalName()        System.out.println(yourAnimal.getAnimalName());     } }