Read This Entire Document Before Beginning Your Lab.: Green
Read This Entire Document Before Beginning Your Lab.: Green
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:
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).