Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions