تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Motivation: The purpose of this project is to give students exposure to object-oriented design and
programming using classes and polymorphism in an application that involves arrays of objects and sorting
arrays containing objects.
You will write several classes for this assignment. Please submit all classes in one file. The name of
the physical program file submitted XXXX_Program8.java, where XXXX is your Kean email id.
Assignment: Best Office Supplies Inc, an office supply store, services many customers. As customers'
orders for office supplies are shipped, information is entered into a file. Best Office Supplies bills their
customers once each month. At the end of each month, the Chief Executive Officer requests a report of
all customers sorted by their customer id (from lowest to highest). The report includes their bill
balance and tax liability. Write a program to produce the outstanding balance report sorted by customer
ID number from the data in the text file. Below is a description of the information on the text file:
⚫ The first line on the file contains the number of customers on the file (numeric) - don't skip this
The fields below repeat for each customer:
。 Customer name (String)
。 Customer ID (numeric integer)
o
Bill balance (numeric)
Email Address (String)
。 Tax liability (numeric or String)
The customers served by the office supply store are of two types: tax-exempt or non-tax-exempt. For
a tax-exempt customer, the tax liability field on the file is the reason for the tax exemptions: education,
non-profit, government, other (String). For a non-tax-exempt customer, the tax liability field is the
percent of tax that the customer will pay (numeric) based on the state where the customer's business
resides.
Program requirements:
From the information provided, write a solution that includes the following:
• A suitable inheritance hierarchy which represents the customers serviced by the office
supply company. It is up to you how to design the inheritance hierarchy. I suggest a
Customer class and appropriate subclasses.
. For all classes include the following:
。
Instance variables
。 Constructors
。 Accessor and mutator methods
。 Suitable toString() methods
Any other appropriate methods
Write a class XXXX_Program8.java which utilizes the following:
o An Array(List) of Customer objects
A method which reads the input file provided and stores the objects in the array of
Customers.
A method which sorts the array of Customers in ascending order by the customer ID.
⚫ A method that formats and prints the output report on a monitor. The report should include
the following requirements:
Report header at the start of each page showing the name of the company, report
and page number.
Report headers for each column of information.
One Customer per line.
■ At most 20 Customers per page.
■ All money amounts and percentages should be displayed with 2 decimal places and
commas after each thousand.
• A sample report is shown at the end of the assignment. The report produced does not have
to exactly match the sample output provided but must contain all required components
listed above.
。 Any other helper methods used to meet the requirements of the assignment.
The main method will call all the other methods which will:
Read the text file and store the objects in the Array(List)
. Sort the objects in ascending order by ID
Format and print the report
Office Supplies Inc Customer Report
Page: 1
Kean
Customer
======
==
1
ID
Email Address
=============
purchasing@kean.edu
Balance
=======
158000.50
Тах Туре
========
education
Tax Amount
==========
Vassar
2
purchasing@vassar.edu
53000.00
education
Google
3
purchasing@google.com
500.50
0.01
5.01
SetonHall
8
purchasing@setonhall.edu
158090.50
education
JCU
9
purchasing@jcu.edu
135678.50
education
Rutgers
10
purchasing@rutgers.edu
32000.00
education
UPenn
11
purchasing@upenn.edu
350000.00
education
CountyCollege1
12
purchasing@cc1.edu
5000.00
education
LegoInc
18
purchasing@lego.com
1978.50
0.02
NYYankees
19
purchasing@nyyankees.com
15500.00
0.07
39.57
1085.00
NJIT
99
purchasing@NJIT.edu
13978.50
education
Allied
100
purchasing@allied.com
85300.00
0.06
5118.00
TiresToGo
108
purchasing@tirestogo.com
8300.00
0.06
498.00
CountyCollege2
109
purchasing@cc2.edu
1678.50
education
Fridays
110
purchasing@fridays.com
5300.00
0.06
318.00
Montclair
111
Linden
112
purchasing@montclair.edu
purchasing@linden.gov
39800.00
education
3800.00
other
Enterprise
120
purchasing@enterprise.com
75300.00
0.06
4518.00
ChocolateRus
125
purchasing@chocolate.com
3000.50
0.10
300.05
Beans
126
purchasing@beans.com
1000.50
0.03
30.02
Flowers Rus
339
Tires Inc
345
Uber
348
purchasing@flowers.com
purchasing@tires.com
purchasing@uber.com
59300.50
0.08
4744.04
25000.00
0.07
1750.00
1500.00
0.05
75.00
Office Supplies Inc Customer Report
Page: 2
Customer
ID
Email Address
Balance
Тах Туре
Tax Amount
Threads
349
purchasing@threads.com
DAV
358
purchasing@dav.org
29000.00
4860.20
0.05
non-profit
1450.00
DAV2
359
purchasing@dav2.org
4860.20
non-profit
StopandShop
377
purchasing@stopandshop.com
8100.00
0.06
486.00
Alamo
520 purchasing@alamo.com
23000.00
0.05
1150.00
Hertz
521
purchasing@hertz.com
22200.00
0.07
1554.00
EnginesRus
522
BusinessRUS
531
purchasing@enginesrus.com
purchasing@businessrus.com
23500.00
0.06
1410.00
1200.00
0.08
96.00
CareBear
535 purchasing@carebear.com
6000.00
0.08
480.00
PinkElephant
536
BabyGap
538
purchasing@pinkelephant.com
purchasing@babygap.com
600.00
0.05
30.00
6100.00
0.07
427.00
Thrifty
539 purchasing@thrify.com
6600.00
0.07
462.00
BabyToys
539
DryCleaners
CheapFood
540
purchasing@babytoys.com
purchasing@drycleaners.com
6000.00
0.04
240.00
6800.00
0.05
340.00
551 purchasing@cheapfood.com
2210.00
0.04
88.40
Rubrics:
Requirement
% Possible
% Earned
Presence of instance variable in all created classes in proper format
(naming conventions, correct data types, encapsulation)
Presence of Constructors (a no-args constructor and a constructor
that receives all possible parameters are a must)
5
5
Accessors and mutators should be implemented for all instance
variables
5
toString() method is present in every class
The main method calls all other methods (all three methods should
be invoked by main())
Array(List) of Customers is created and utilized
5
10
5
Method to sort the array in ascending order by ID is present and
implemented correctly
15
Method which reads text file (URL data) and stores objects in
Array(List) of Customers
15
15
Method to print report in proper format (One customer per line,
header, page break for every 20 Customers) is present and
implemented correctly
Testing with input file provided - no errors (successful run)
Descriptive Comments throughout all program(s) and program
header as requested
Program name and submission format as requested (all in one file)
Total %
10
5
5
100
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.