subject
Computers and Technology, 07.03.2020 02:33 slm1595

Print person1's kids, call the incNumKids() method, and print again, outputting text as below. End each line with a newline.
Sample output for below program with input 3:

Kids: 3
New baby, kids now: 4
// Code from file PersonInfo. java
public class PersonInfo {
private int numKids;

public void setNumKids(int setPersonsKids) {
numKids = setPersonsKids;
}

public void incNumKids() {
numKids = numKids + 1;
}

public int getNumKids() {
return numKids;
}
}
// end

// Code from file CallPersonInfo. java
import java. util. Scanner;

public class CallPersonInfo {
public static void main (String [] args) {
Scanner scnr = new Scanner(System. in);
PersonInfo person1 = new PersonInfo();
int personsKid;

personsKid = scnr. nextInt();

person1.setNumKids(personsKid);

/* Your solution goes here */

}
}
// end

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass.cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array.c . run this program and observe the results.
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
Match the items with their respective descriptions.
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
You know the right answer?
Print person1's kids, call the incNumKids() method, and print again, outputting text as below. End e...
Questions
question
Mathematics, 11.05.2021 04:50
question
Mathematics, 11.05.2021 04:50
question
Mathematics, 11.05.2021 04:50
question
Mathematics, 11.05.2021 04:50
Questions on the website: 13722362