Question: I was given an assignment that I cant figure out to save my life. it's a 2 part assignment. I got the first part figured

 I was given an assignment that I cant figure out to

save my life. it's a 2 part assignment. I got the first

I was given an assignment that I cant figure out to save my life. it's a 2 part assignment. I got the first part figured out but I'm struggling with the second part. any help would be awesome. the first picture is the first part of the assignment I figured out. the second picture is the assignment I cant figure out.

import java.util.Scanner; class Author{ private String firstName; private String lastName; Author(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public void setFirstName(String firstName) { this.firstName = firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getFirstName() { return this.firstName; } public String getLastName() { return this.lastName; } public String toString() { return firstName + " " + lastName; } } class Book{ private String title; private Author author; private double price; Book(String title, Author author, double price){ this.title = title; this.author = author; this.price = price; } public void setTitle(String title) { this.title = title; } public void setauthor(String author) { } public void setprice(String price) { } public String toString(){ return this.title + " " + author.toString() + " " + this.price; } } //End Class Book class TestBook{ public static void main(String[] aargs) { Scanner input = new Scanner(System.in); Author author = new Author("Daniel" , "Liang"); Book book = new Book("Programming in Java" , author , 75.95); showDetails(book); } public static void showDetails(Book book) { System.out.println(book.toString()); }// end method showDetails //end class TestBook }

1 import java.util.*; 2 class Author 3 private String firstName; private String lastName; 7 Author(String firstName, String lastName) { this. firstName - firstName; this.lastName - lastName; 10 11 public void setFirstName(String firstName) { this. firstName - firstName; 15 17 public void setLastName(String lastName) { this.lastName = lastName; } public String getFirstName() { return this. firstName; > 19 20 21 public String getLastName() { return this.lastName; 24 25 27 public String toString() { 28 return firstName + " + lastName; 20 3 1/ end class Author 32 class Book private String title; private Author author; private double price; Book(String title, Author author, double price) { this.title - title; this.author - author; this.price = price; public void setTitle(String title) ( this.title-title 45 public void setAuthor(Author author) { this. author - author; public void setPrice ( double price) { this.price - price; public String getTitle() return this, title: public Author getAuthor() { return this.author; public double getPrice() { return this. price; Page 2 of 2 Untitled1 Printed at 10:00 on 23 Jan 2020 public String toString( return this.title + " " + author. tostring() + " 61 + this.pric 64 }//end class Book 65 66 class TestBook public static void main(String[] args) { 68 Scanner input = new Scanner(System.in); Author author = new Author("Daniel","Liang"); Book book-nev Book("Programming in Java", author, 75.95); showDetails(book); )// end main method public static void showDetails(Book book) 74 System.out.println(book.toString(); //end method showDetails 76 }//end class TestBook 77 70 71 73 CS-226 Programming nment 2-1/24/2020 Using the classes Author and Book from Programming Assignment 1, add a class BookStore with following features: 1) Instance variables: a) address - bookstore's street address (private String) b) city - (private String) c) state - (private String) d) Array or ArrayList - (private String) 2) Constructor method - BookStore(String address, String city, String state) 3) Instance methods: a) public void setAddress(String address) b) public void setCity (String city) c) public void setState(String state) d) public void add Book(String book) e) public String getAddress() f) public String getStatel) 8) public String getCity h) public void showStock() - display books in stock (contents of array or arraylist) Write a separate class TestBookStore with the follow features: 1) Main method which creates a bookstore object for a store location of "731 Main Street", "Florence". "SC". 2) A loop which (for test purposes) executes 3 iterations prompting the user to enter a book title, author first name, author last name, and the book's price. A book object is then instantiated from the Book class and added to the book list in the bookstore object. 3) A method showStock() which is called on exiting the loop. This method will display the contents of the array/array list oh the bookstore object. Running test class D:C8226-Spring2020 Programming Projects\Bookstore Java Enter Book Title: The Good German Enter Author's first name: Joseph ast name: Kano 3 input iterations 14.95 History as Mystery Enter Author's first name: Michael Enter Author's last name: Parenti Enter book price: 17.49 Enter Book Title: Marching with Sherman Enter Author's first name: Mark Enter Author's last name: Dunkelman Enter book price 29.99 The Good German Joseph Kano 14.95, History as Mystery with Sherman Mark Dunkelman 29.99) Results in this output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!