Question: JAVA - The setSpecies ( ) mutator sets field species to inputSpecies and the setName ( ) mutator sets field name to inputName. In main
JAVA
The setSpecies mutator sets field species to inputSpecies and the setName mutator sets field name to inputName. In main call setSpecies and setName passing arguments inputSpecies and inputName, respectively.
Ex: If the input is:
snake
Taj
then the output is:
The snake's name is Taj
import java.util.Scanner;
public class AnimalData
public static void mainString args
Scanner scnr new ScannerSystemin;
Animal animal new Animal;
String inputSpecies;
String inputName;
inputSpecies scnrnext;
inputName scnrnext;
Your code goes here
System.out.printThe animal.getSpecies;
System.out.printlns name is animal.getName;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
