Ok i need to do this for my final and im really struggling and needhelp. Thank Y
ID: 3611302 • Letter: O
Question
Ok i need to do this for my final and im really struggling and needhelp. Thank YouWrite a project to keep the inventory of books in a book store.Create a book class with the following variables and methods
Title
Price
Pages
getTitle()
setTitle()
setPrice()
getPrice()
setPages()
getPages()
create a subclass ok book called booklet with the followingadditional method
display properties()
The displayProperties method will print the title, price, andnumber of pages. Create a GUI to create booklets and display eachbooklets properties.
Explanation / Answer
public class Book{ String title; double price; int pages; public String getTitle(){ return title; } public void setTitle(String s){ title = s; } public void setPrice(double p){ price = p; } public double getPrice(){ return price; } public void setPages(int p){ pages = p; } public int getPages(){ return pages; } } Also you can write this function to display the items in theother class public void displayProperties(){ System.out.println("Title: " + title + " Price: $" + price +" Pages: " + pages); } Hope that helps.Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.