Question
Please I need help in writing javaFx program that sow me the picture above The first image shows the initial image produced by the program.
Please I need help in writing javaFx program that sow me the picture above
The first image shows the initial image produced by the program. It has labels for Author, Title and Pages, and under each label is a TextField accepting user input for the associated information. It also has a button for Make New Book. The user can fill in each required data in each TextField, and when the button is pushed the program creates a Book object and adds it to a DataSetBook.
Below the widgets described above is a TextArea displaying the toString value of the DataSetBook object. As Make New Book is pushed and a new Book added to the DataSetBook, the TextArea is updated.
The second image shows that data has been entered for a book, but the button not yet pushed.
In the third image, the button has been pushed and the first book added to the DataSetBook.
The last image shows a second book has been entered, the button pushed, and the TextArea updated.A Book class is attached to this item for your use. Use the DataSetBook to improve on this GUI's appearance. You may wish to tweak the toString methods of Book and DataSetBook. You should use a simple, named inner class
---------------------------------------
public class Book {
private String author;
private String title;
private int pages;
public Book(String auth, String titl, int pag) {
author = auth;
title = titl;
pages = pag;
}
@Override
public String toString() {
return "Book [author=" + author + ", title=" + title + ", pages=" + pages + "]";
}
public String getAuthor() {
return author;
}
public String getTitle() {
return title;
}
public int getPages() {
return pages;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Book other = (Book) obj;
if (author == null) {
if (other.author != null)
return false;
} else if (!author.equals(other.author))
return false;
if (pages != other.pages)
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}}
--------------
public class DataSetBook extends ArrayList
public DataSetBook() {
}
public boolean add(Book objToAdd) {
return super.add(objToAdd);
}
public int size() {
return super.size();
}
public Book getMin() {
if (super.isEmpty()) {
return null;
}
Book mEle = super.get(0);
for (int i = 1; i
if (mEle.getPages() > (super.get(i).getPages())) {
mEle = super.get(i);
}
}
return mEle;
}
public Book getMax() {
if (super.isEmpty()) {
return null;
}
Book mEle = super.get(0);
for (int i = 1; i
if (mEle.getPages()
mEle = super.get(i);
}
}
return mEle;
}
@Override
public String toString() {
return "DataSetBook size()=" + size() + " getMin()=" + getMin() + " getMax()=" + getMax()
+ " Books= " + super.toString() ;
}
Author Title Make New Book DataSetBook []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