Here is the source code for the LooseLeaf class: The code for the Infant class i
ID: 3786547 • Letter: H
Question
Here is the source code for the LooseLeaf class:
The code for the Infant class is here:
The code below includes a live Infant variable, danasKid. Using statements from the LooseLeaf and Infant classes, make a LooseLeaf object called someBook with name field filled with danasKid's name, and initial blank page count equal to danasKid's age.
For example, if Dana's kid's name is Lena, and Lena is 19 months old, then these would be the values of the name and blankPage instance variables in the someBook object.
A hint is provided at the bottom of this page. Enter your code in the box below.
Explanation / Answer
Hi Friend, You have not posted any other code except LooseLeaf and Infant class.
Based on question discussion, I have created Test class.
PLease let me know in case of any issue.
public class LooseLeafInfantTest {
public static void main(String[] args) {
// creating Infant Object
Infant danasKid = new Infant("Lena", 19);
// creating LooseLeaf Obejct
LooseLeaf someBook = new LooseLeaf(danasKid.getName(), danasKid.getAge());
System.out.println("Name: "+someBook.getName()+", Balank Pages: "+someBook.getBlankPages());
}
}
/*
Sample run:
Name: Lena, Balank Pages: 19
*/