English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

From below, how would I apply some of the data in the brackets to variables such as "introduction" to a variable called "name" , and the number in the brackets to a variable say "page number"?

Page[] books = new Page[10];
books[0] = new Page(50, "introduction");
books[1] = new Page(75, "chapter 1");
String d = books[0].getDescription();

2007-05-17 21:48:19 · 4 answers · asked by DM 1 in Computers & Internet Programming & Design

4 answers

String name = books[0].getTitle();
pageNumber = books[0].getPageNumber();

But you will have to write the methods in the Page class to return these values.

2007-05-17 22:05:54 · answer #1 · answered by AnalProgrammer 7 · 1 0

1

2017-01-21 23:24:28 · answer #2 · answered by ruben 4 · 0 0

Pseudocode :

Create new book

var a = books[x].GetPageNumber;

int GetPageNumber()
return PageNumber;

Display "The page number is " + a;

End

I hope you follow the logic of that? You must create a function to return the page number to the variable.

2007-05-17 23:41:25 · answer #3 · answered by Siu02rk 3 · 0 0

dm try this link

http://www.google.co.uk/search?hl=en&q=Applying+Array+Data+to+Variables&btnG=Google+Search&meta=

2007-05-17 22:16:12 · answer #4 · answered by Joe_Young 6 · 0 0

fedest.com, questions and answers