Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a program, which prints a table of contents. Use the following data structure: public class TocEntry // Specify the needed methods private String
1. Write a program, which prints a table of contents. Use the following data structure: public class TocEntry // Specify the needed methods private String chapter private int page In your driver/test program define: public final int TOCSIZE 100; TocEntry toc[]-new TocEntry[TOCSIZE] int toc curlen 0 Next develop the necessary code, in your TocEntry class, to read in a chapter name and page number until "****is entered. From this generate an output, e.g.: Sample run: % java useTocEntry Enter chapter title: Camelot Enter starting page number: 1 Enter chapter title: King Arthur' s Court Enter starting page number: 3 Enter chapter title: Knights of the Table Round Enter starting page number: 8 Enter chapter title: Sir Dinadan the Humorist Enter starting page number: 12 Enter chapter title: An Inspiration Enter starting page number: 14 Enter chapter title: The Eclipse Enter starting page number: 23 Enter chapter title: A Postscript by Clarence Enter starting page number: 274 Enter chapter title: Camelot King Arthur's Court Knights of the Table Round Sir Dinadan the Humorist An Inspiration The Eclipse A Postscript by Clarence... 12 14 23 274
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started