0% found this document useful (0 votes)
97 views1 page

Read This Entire Document Before Beginning Your Lab.: Green

The document provides instructions for a lab exercise to create a Book class. Students are given a Book.java file to complete that already contains a main method for testing. The Book class must contain private String and double attributes for the author, ISBN, and price, along with a constructor, getters/setters, an equals method, and toString method defined as specified. Running the main method should output sample text exactly as shown if implemented correctly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views1 page

Read This Entire Document Before Beginning Your Lab.: Green

The document provides instructions for a lab exercise to create a Book class. Students are given a Book.java file to complete that already contains a main method for testing. The Book class must contain private String and double attributes for the author, ISBN, and price, along with a constructor, getters/setters, an equals method, and toString method defined as specified. Running the main method should output sample text exactly as shown if implemented correctly.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Lab Exercise 7.

1_H_I_L COMP 248

Due date: Today, at the end of the lab period.

Read this entire document before beginning your lab.


Make sure to locate and place the PC2 Lab System on your desktop. The Comp248_Lab_Manual file is available on
the H: drive if you don’t remember how to use the system, you should worry about this after completing the
question.
For this lab you are required to fulfill all requirements exactly as described in this provided document, no less, no
more.

NOTE: Today’s lab has a different format. You are given a .java file that you are to complete and submit to PC2.
The file already has a main method (that you are NOT to modify) that will test your implementation once
completed.

Lab Question Complete Book.java file provided with this handout. Again this file already has a main method
(that you are NOT to modify) that will test your implementation once completed. Here are all the requirements
you are to fulfill exactly as described before submitting your work. Failing to do so will result in your program
not working.
Your class must contain:
 3 private attributes: author, and ISBN which are of type String and price which is a double.
 A constructor which sets all of the attributes to the corresponding values passed.
 Getters and setters must be provided for the 3 attributes.
 An equals method: two objects of type Book are equal if their matching attributes are equal.
 A toString function must also be provided to return the Book information in the following format: Book
info: author = <author>, ISBN = <ISBN>, price = <price>
Where <author>, <ISBN> and <price> are the content of the attributes. (See sample output below.)

If you correctly implemented all of the above, running the main method will result in your program displaying
exactly: (REMEMBER in the output: ◦ is a space,  is a tab and  is a new line. Text in
green is user input.)

Enter◦author◦(family◦name◦only):◦Acemian
ISBN◦and◦price:◦ACEbk123876◦127.69
Book◦info:◦author◦=◦Acemian,◦ISBN◦=◦ACEbk123876,◦price◦=◦$127.69
Book◦info:◦author◦=◦Acemian,◦ISBN◦=◦ACEbk123876,◦price◦=◦$127.69
true
Book◦info:◦author◦=◦Acemian,◦ISBN◦=◦ACEbk123876,◦price◦=◦$127.69
Book◦info:◦author◦=◦Acemian,◦ISBN◦=◦ACEbk123876,◦price◦=◦$191.535
false
Note:

1. The use of libraries other than java.util.Scanner is prohibited.


2. Do not modify the main method provided.

Reminder:
When submitting your solution to the lab system, make sure there is no package statement
at the top of your .java file as this will result in a grade of 0 (restriction of this system).

You might also like