Java Reference
In-Depth Information
Programming Assignments
1 Writing Java Code from a Flowchart
Start TextPad. Open the file Book.java from the Data Disk. See the preface of this
book for instructions for downloading the Data Disk or see your instructor for
information about accessing the files required in this topic. Using the techniques
you learned in this chapter, write the lines of code inside the main() method to
print the bibliographic entry as outlined by the flowchart in Figure 2-74.
Begin
Display the name
of this topic
Display the authors
of this topic (see
first page of preface)
Display publication
data (see preface)
End
FIGURE 2-74
1. With the Book.java source code displayed in the TextPad coding window,
locate the access modifier and class name, Book. Change the class name to
Biblio. Change the name to Biblio in the comment header, and enter your
name as the programmer.
2. Click inside the main() method braces.
3. After studying the flowchart in Figure 2-74, enter the lines of code necessary
to produce the output.
4. Save the file on the Data Disk with the name Biblio. Make sure you choose
Java (*.java) in the Save as type box.
5. Compile the program. If errors occur, fix them in the TextPad coding win-
dow and compile again.
6. Run the program. If the program runs correctly, return to TextPad and print
a copy of the source code. Otherwise, return to Step 3 and correct the errors
until the program runs error-free.
 
Search WWH ::




Custom Search