Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class called Book.java that has attributes named category, title, author

ID: 645093 • Letter: W

Question

Write a class called Book.java that has attributes named category, title, author, and price.  

Write two constructor methods. One constructor should require title and author and the other constructor should require title only. Write a get method for all attributes and write a set method for all attributes except title. Also write a class method called totalPrice that calculates the price of the book including tax. Assume the tax rate is 6.75%.

Write another class called BookStore that contains a main method. In the main method use input dialog boxes to retrieve information from the user to create a book object. After creating the object, use the getter methods to retrieve the information and use a message box to display the information. Also display the total price which includes tax using the totalPrice method. Below is example output that should be displayed in one message box.

Category: Computer Science
Title: Java Programming
Author: Joyce Farrell
Base Price: $143.28

Total Price: $152.95

Note: The total price shown in the example output is rounded to two decimal places. This is not required however if you do add the code to round to the nearest cent then you can receive additional points to help offset any other point deductions you may receive.

**This is for a test so it cannto be anything more advanced than chapter 4.**

Here's all that I have so far, please just finish it for me if you can. Thank you...

public class Book {

   private int category;
   private String title;
   private String author;
   private double price;
  
   private Book(int category, String title, String author, double price){
       this.title = title;
       this.author = author;
   }
   public String getTitle(){
       return this.title;
   }
   public void getTitle(String title){
       this.title = title;
   }
   public String setAuthor(){
       return this.author = author;
   }
  
   public int setCategory() {
       return this.category;
   }
   public double setPrice(){
       return this.price;
   }
      
  
}  

----------------------------------------------------------------------

import javax.swing.JOptionPane;

public class BookStore {

   public static void main(String[] args) {
      

   }

}

Explanation / Answer

public class Book {

   private string category;
   private String title;
   private String author;
   private double price;

private int category;
  
   private Book(string category, String title, String author, double price){
       this.title = title;
       this.author = author;

       this.category = category;
       this. price = price; }


    private Book( String title){
       this.title = title;   }
public double totalPrice(float price)

{double tp=0.0675*price+price;

return tp;

}

   public String getTitle(){
       return this.title;
   }

   public String getAuthor(){
       return this.author ;
   }

public void setAuthor(String author){
this.author = author;

   }

   public String getCategory(){
       return this.category ;
   }

public void setCategory(String category){
this. category = category;

   public String getPrice(){
       return this.price ;
   }

public void setPrice(String price){
this. price = price;

   }

  
}  

----------------------------------------------------------------------

import javax.swing.JOptionPane;

public class BookStore {

bb.setAuthor(author);

bb.setPrice(price);

bb.setCategory(category);

bb.setTitle(title);

double totPrice=bb.totalPrice(price);

   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote