Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in JAVA Q2) write a java program with the following steps: 1- Create a java class file Book which has the following properties: Book -title:String
in JAVA Q2) write a java program with the following steps: 1- Create a java class file Book which has the following properties: Book -title:String -price:double -category: String -authorName:Author +constructors (you should include all the needed constructors) +getters and setters(you should include the setters and getters needed for data members) +override method toString():String (represent the book with all its information) +override method equals(Book b):boolean (it will check the equality of any two books according to their title) Note: Category data member takes historical, Health, or academic value. 2- Create another java class file Author which has the following properties: Author name Strinn Meer 8 of 10 Author name:String gender String constructors you should include all the needed constructors) getters and setters you should include the setters and getters needed for data members) override method toString String (represent the author with all his her Information) override method equals(Author a boolean it wil check the quality of any two authors according to their name and gender. Note: gender data member takes Male or Female value 3. Create an main class tile Test and do the following: A) Decare an array Books of type book wth size 3 B) Print the following menu to give the user optionality Choose 2 to retrieve historical books Choose to check the quality of first and last books in the array C) from the user to enter for information for the new book title.price, type, and the info of author name and gender the print the books with the new one Warner the themes the second chance, you should the stomation or at the E) When the user chooses the last choice, you should check the equality of the first book with the last book in the array by using the override method equals on Book Class) Sample Run: Choose to insert a new book Choose to retrieve history books Choose 3 to check the quality of first and last books in the array Choose 0 to ext. Please enter your choice 1 Please enter the title Introduction to Java programming Please enter the price 35 Please enter the type: Academic Please enter the author name: Please enter the author name Dietel Llang Please enter his/her gender Male The allBooks array contains Introduction to Java programming 35 his author Dietel Liang Male Choose to insert a new book Choose to retrieve story books. Choose 3 to check the equality of first and last books in the array Choose to ex Please enter your choice 1 Please enter the te History of the Caliphs Please enter the price 57 Please enter the type: Historical Please enter the author name: Jalaluddin Al-Suyuti Please enter hisher gender Male The all Books array contains: Introduction to java programming 35 Academic his author Dirtel Liang Male History of the Caliphs 57 Historical thor Jaluddin Al-Suyuti Male Male The alilooks array contains Introduction to Java programming 35 Academic his author Diletel Liang Male History of the Caliphs 57 Histoncal his author Jalaluddin N-Suyuti Male Choose 1 to insert a new book. Choose 2 to retrieve history books Choose 3 to check the quality of fest and last books in the array Choose to ext Please enter your choice 2 The Historical booksis are: History of the Caliphs 57 Historical his author Jalaluddin Al-Suyuti Male Choose 1 to insert a new book Choose 2 to retrieve history books. Choose 3 to check the quality of first and last books in the array Choose to ext Please enter your choice 3 Introduction to java programming not equal to History of the Caliphs. Good Luck
in JAVA
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started