Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

Show the properties and structure of allotropes of carbon.

Answered: 1 week ago

Question

If none of the solutions seem satisfying, pick the more easier one.

Answered: 1 week ago

Question

You are to meet him on friday at the un building in nyc.

Answered: 1 week ago