Hello,
This is my first time to post on the forum, so I hope I'm doing this correctly. I am working on the dreading Java Inventory Program that seems to be legendary. I am currently on part 3 and have most of the program working. I created an additional feature (book author) in a subclass, which is supposed to be called in my main class and populate my array. I've created the subclass and added the new feature, but can't figure out how to call it in my main class to populate and display in my array. Any tips or advice is greatly appreciated!
I read the guidelines, so I'm a little worried about posting too much code. I've attached a part of my subclass where I created my "new" feature, hoping this is a good starting point and someone can confirm if I set this part up correctly.
Thanks!
This is my first time to post on the forum, so I hope I'm doing this correctly. I am working on the dreading Java Inventory Program that seems to be legendary. I am currently on part 3 and have most of the program working. I created an additional feature (book author) in a subclass, which is supposed to be called in my main class and populate my array. I've created the subclass and added the new feature, but can't figure out how to call it in my main class to populate and display in my array. Any tips or advice is greatly appreciated!
I read the guidelines, so I'm a little worried about posting too much code. I've attached a part of my subclass where I created my "new" feature, hoping this is a good starting point and someone can confirm if I set this part up correctly.
Thanks!
Code:
public class Book2 extends Book { // Book2 variable private String bookAuthor; // Author of the book // Book2 constructor public Book2(String bookTitle, int itemNumber, int bookUnits, double bookPrice, String bookAuthor) { // call super class constructor super(bookTitle, itemNumber, bookUnits, bookPrice); this.bookAuthor = bookAuthor; // initializes bookTitle for Book2 } // end constructor // method to set the book author public void setBookAuthor (String bookAuthor) { this.bookAuthor = bookAuthor; } // end method setBookAuthor // method to retrieve the book author public String getBookAuthor() { return bookAuthor; } // end method getBookAuthor
Comment