Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Implement a class Book (Book.java). A book will have three instance variables: a title (a String, for example: "Big Java" or "The Hitchhiker's Guide to the Galaxy"), an author (a String, for example: "Cay Horstmann" or "Douglas Adams") and a price (a double, for example: 80.00 or 24.99). The class must include a:

  • Default constructor,
  • Parameterized constructor with three parameters (title, author, and price),
  • Accessor method to return the title,
  • Accessor method to return the author,
  • Accessor method to return the price,
  • Mutator method to set the title,
  • Mutator method to set the author,
  • Mutator method to set the price.

Implement a driver program (BookTest.java) to test out all the constructors and methods of your class as follows:

  • Create at least two Book objects, one using the default constructor and one using the parameterized constructor.
  • Use themutatormethods to set the title, author, and price for the Book object that was created using the default constructor.
  • Use theaccessormethods to get information that is then printed in sentences containing the author, title, and price of each book. An example sentence might be, "The Big Java book by CayHorstmanncosts $69.99." (Note that some of the information in this string comes from the values of your instance fields and the rest is text that you supply.

Document your Book class completely, using the appropriate Javadoc tags in your code. Include comments for the class, instance fields, and all methods. Use the JavaDocutility to generate an HTML documentation page for your Book class. In grading your project, we will generate the JavaDoc file from your source code file, so you do not have to turn it in.

You should have three files for this project:

    Book.java                     The Book class that has all the constructors and methods 
    BookTest.java               A driver program to test your Book class
    Book.html                     The documentation file generated from your Book class

Java, Programming

  • Category:- Java
  • Reference No.:- M9526377

Have any Question?


Related Questions in Java

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Operating systems assignment -problem 1 sharing the bridgea

Operating Systems Assignment - Problem 1: Sharing the Bridge A new single lane bridge is constructed to connect the North Island of New Zealand to the South Island of New Zealand. Farmers from each island use the bridge ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As