subject

Write a class named book containing:

a. three instance variables named title, author, and tableofcontents of type string. the value of tableofcontents should be initialized to the empty string.
b. an instance variable named nextpage of type int, initialized to 1.
c. a constructor that accepts two string parameters.
d. the value of the first is used to initialize the value of title and the value of the second is used to initialize author. a method named addchapter that accepts two parameters.
e. the first, of type string, is the title of the chapter; the second, is an integer containing the number of pages in the chapter. addchapter appends (that is concatenates) a newline followed by the chapter title followed by the string "" followed by the value of the nextpage instance variable to the tableofcontents.
f. the method also increases the value of nextpage by the number of pages in the chapter.
g. a method named getpages that accepts no parameters. getpages returns the number of pages in the book.
h. a method named gettableofcontents that accepts no parameters. gettableofcontents returns the values of the tableofcontents instance variable.
i. a method named tostring that accepts no parameters. tostring returns a string consisting of the value of title, followed by a newline character, followed by the value of author.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 23.06.2019 11:30
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
question
Computers and Technology, 24.06.2019 12:30
Select all that apply. what two keys listed below should you use to enter data in an excel worksheet? tab backspace enter right arrow
Answers: 2
question
Computers and Technology, 24.06.2019 17:30
Looking at the electroscope, describe how you can cause the two leaves at the bottom to repel each other and stay that way
Answers: 3
You know the right answer?
Write a class named book containing:

a. three instance variables named title, author, a...
Questions
Questions on the website: 13722359