Answered step by step
Verified Expert Solution
Question
1 Approved Answer
| Introduction to Programming Final Project Fall 2 0 2 3 Consider a class named Books that has following private attributes: title: The tile is
Introduction to Programming
Final Project
Fall
Consider a class named Books that has following private attributes:
title: The tile is a String that holds the book's title.
author: The author is a String that holds the author's last name.
year: The year is an int that holds the book's publishing year.
saleNumbers: The saleNumber is an array of ints that holds number of books
sold in the first half of the year.
In addition, the Books class has following public Methods:
Constructor: The first constructor of the Books class accepts three parameters for
the title, author and year. It should also instantiate the array to its size. There
should be no console IO in the Books class.
Constructor: The second constructor of the Books class accepts four parameters
for the title, author, year and an int array for the number of books sold in the first
half of the year. There should be no console IO in the Books class.
Accessor methods for each class attribute.
Mutator methods for each class attribute.
setSaleNumbers: This method is an overloaded method. This method should
only take two integers as parameters, one as a number of books sold and the other
one as a month number. This method will place an int value into the saleNumbers
array in the specified index.
getSaleNumbers: This method is an overloaded method. This method takes
an integer as a month number and returns an int which is the number of books
sold in that specific month.
getTatal; This method returns the total number of the hooks that are sold in the
first half of the year.
Draw the UMI diagram of the Books class.
Write the Java Code for the Books class that includes all the fields and the methods.
Demonstrate the Books class by creating another class named BookDeme driver class
that has a main method. This BookDeme class is only there to test the functionality of
your Books class. You will exercise the methods of the book class to make sure they are
working properly. The Book class should not do any IO to the console; only the
BookDema class' main method should interact with the console.
You will be given a file named "data.txt
This file contains the data about each book. The data consists of each book's title, it's
author, the year that the book published and the number of copies of the book sold in first
half of the year. A typical record in the file would be as follows:
Java Early Objects
Gaddis
In the main method you should:
Create an array named booksArray with object elements of type Books.
Read the data about each book from "data txt and
Create objects of type Books using first constructors with the first lines
of data in the file and store them in the bookArray.
Create objects of type Books using second constructors with the last
lines of data in the file and store them in the bookArray.
Use selection sort algorithm to sort the bogkAcray based on the highest
sale in descending order.
Display the result.
Ask the user to enter a month number and show the sales in that month for
all seven objects stored in the BookArxax,
Instruction for the submission of the project:
The deadine of the submission is on Monday, Dec
Your Java source code should adhere to the programming conventions such as proper
indentations, using meaningful names, using lower case letters for variables and etc.s
marks
Your Java source code should have proper comments. marks
You should check off your code with your instructor during the labs and classes in
Person. You can show your project during the office hours, during the class and during
the following dates and times:
a Decemher from to
b Decemher from to
If you fail to checkoff the project with your instructor in person, even if you submit the
project via LEA, you will still get in the project.
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