subject

Write a class named book containing: three instance variables named title, author, and tableofcontents of type string. the value of tableofcontents should be initialized to the empty string. an instance variable named nextpage of type int, initialized to 1. a constructor that accepts two string parameters. 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. 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. the method also increases the value of nextpage by the number of pages in the chapter. a method named getpages that accepts no parameters. getpages returns the number of pages in the book. a method named gettableofcontents that accepts no parameters. gettableofcontents returns the values of the tableofcontents instance variable. 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 14:40
You are working with a professional edition organization. they wish to install the expense tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. if the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install expense tracker?
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
The basic work area of the computer is it screen that you when you first fire up your computer
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
What is the process in which the software development team compiles information to determine the final product
Answers: 1
You know the right answer?
Write a class named book containing: three instance variables named title, author, and tableofconte...
Questions
question
Mathematics, 19.03.2021 21:40
question
Mathematics, 19.03.2021 21:40
question
Mathematics, 19.03.2021 21:40
question
Social Studies, 19.03.2021 21:40