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 12:00
Which of the following “invisible” marks represents an inserted tab?
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Why is it uncommon for users to perform searches directly in database tables? a.)users are discouraged from interacting directly with tables because they might confuse tables with spreadsheets. b.) users are discouraged from interacting directly with tables because this may result in unintended changes to source data. c.)users do not have the technical skills required to perform searches directly in database tables. d.)users do not have the permissions required to perform searches directly in database tables.
Answers: 1
question
Computers and Technology, 24.06.2019 11:20
Print "censored" if userinput contains the word "darn", else print userinput. end with newline. ex: if userinput is "that darn cat.", then output is: censoredex: if userinput is "dang, that was scary! ", then output is: dang, that was scary! note: if the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "program end never reached." the system doesn't print the test case that caused the reported message.#include #include using namespace std; int main() {string userinput; getline(cin, userinput); int ispresent = userinput.find("darn"); if (ispresent > 0){cout < < "censored" < < endl; /* your solution goes here */return 0; }
Answers: 3
question
Computers and Technology, 24.06.2019 13:50
Write a program that performs a simple n-body simulation, called "jumping leprechauns." this simulation involves n leprechauns, numberd 1 to n. it maintains a gold value g_i for each leprechaun i, which begins with each leprechaun starting out with a million dollars worth of gold, that is, g_i = 1000000 for each i = 1,. in addition, the simulation also maintains, for each leprachaun,i, a place on the horizon, which is represented as a double-precision floating point number, x_i. in each iteration of the simulation, the simulation processes the leprachauns in order. processing a leprachaun i during its iteration begins by computing a new place on the horizon for i, which is determined by the assignment:
Answers: 3
You know the right answer?
Write a class named book containing:

a. three instance variables named title, author, a...
Questions
question
Mathematics, 24.07.2019 08:50
Questions on the website: 13722363