Question: 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

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.

 public class LooseLeaf{ // models a looseleaf notebook, with a running count of blank sheets  private int blankPages; private String name; // notebook owner public LooseLeaf(String who, int blanks){ blankPages = blanks; name = who; } public int getBlankPages(){ return blankPages;} public String getName(){ return name;} public void setBlankPages(int amount){blankPages = amount;} }
public class Infant{ private String name; private int age; // in months public Infant(String who, int months){ name = who; age = months; } public String getName(){ return name;} public int getAge(){ return age;} public void anotherMonth(){ age = age + 1;} }

need in java and also can explain a little how to do this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!