Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a Book class with attributes author(String), title(String), and price(String). make sure you create ALL modifiers and accessors, and a toString that will print the
Create a Book class with attributes author(String), title(String), and price(String).
1 33 Create a Book class with attributes thorString), tithe string). and price Make sure you create ALL moditiers and costs, and at that will print the author the title and the price Create a compare to that will compare according to the title 9 10 11 12 13 14 15 16 17 10 19 20 21 22 23 24 You have been given an input le called book, txt In the input tile there are three lines tot cach book The author is on the titlure, the title on the second line and the price on the third line Write a program to create an arrayant that we ook objects, Get input from the rile, create Book ob and put them into the artist Output the artayat REVERSE Then call Collection Output the arrayLisain, this in te Note: You have been die two input t. You don't know which she webtor dan Verity your pro Work with both by attend the name at the teach * package test2num2: 1.mport java. 10. File: Lmport java.10.YileNotFoundException: import java.util. public class Testam 26 public stati void main(String[] args) Scanner ralenpulli Yule now let) LEY 31 fileInput new Scanner() catch (Filelor roundeception et 1 2 3 4 To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. */ package test2num2; 5 6 7 8 public class Book ( 9 10 make sure you create ALL modifiers and accessors, and a toString that will print the author, the title, and the price.
Create a compareTo thst will compare according to the title.
you have been given an input file called book.txt
in the input file there are three lines for each book
the author is on the first line, the title on the second line, and the price on the third line.
Write a program to create an arraylist thst will hold book objects, get input from the file, create book objects and put them into the arrayList.
output the arrayList in REVERSE.
Then call collections sort.
output the arrayList again, this time not in reverse.
note: you have been given two input files, You dont know which ine we shall use for grading. Verify your program works with both by just altering the name of the file in your try/catch.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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