Question: Java Why is the chapters giving me a zero constantly private String subject; private int numPages; private int chapters; private static final int Pages_per_chapter =

Java Why is the chapters giving me a zero constantly

private String subject; private int numPages; private int chapters; private static final int Pages_per_chapter = 20;

public Textbook( String subject, int numPages) { this.subject = subject; this.numPages = numPages; } public String getSubject() { return subject; }

public void setSubject(String subject) { this.subject = subject; }

public int getNumPages() { return numPages; }

public void setNumPages(int numPages) { this.numPages = numPages; }

public static int getNumPagesPerChapter() { return Pages_per_chapter; }

public int getChapters() { return chapters; } public static int numChapters(int numPages){ int chapters=0; chapters+=(numPages/Pages_per_chapter); numPages=numPages%20; if(numPages>19) chapters++; return chapters; }

}

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!