Answered step by step
Verified Expert Solution
Link Copied!

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 2023
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 I/O 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 I/O 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 I/O 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
2020
200304090100
In the main method you should:
Create an array named booksArray with 7 object elements of type Books.
Read the data about each book from "data txt" and
Create 4 objects of type Books using first constructors with the first 4 lines
of data in the file and store them in the bookArray.
Create 3 objects of type Books using second constructors with the last 3
lines of data in the file and store them in the book-Array.
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 7 seven objects stored in the BookArxax,
Instruction for the submission of the project:
The deadine of the submission is on Monday, Dec 18th.
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 (10
marks)
Your Java source code should have proper comments. (10 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.15th Decemher 2023, from 9AM to 12pm,
b.18th Decemher 2023 from 3PM to 6PM.
If you fail to checkoff the project with your instructor in person, even if you submit the
project via LEA, you will still get 0 in the project.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions

Question

=+1. Is it OK for a firm to profit from poverty?

Answered: 1 week ago