Question
Write in java language ================== Office Supplies Inc., an office supply store, services many customers. As...
Write in java language ================== Office Supplies Inc., an office supply store, services many customers. As customers’ orders for office supplies are shipped, information is entered into a file. 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 for each customer from the data in the text file. You must use the text file provided for the report in Canvas. 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) ? The fields below repeat for each customer: o Customer name (String) o Customer ID (numeric integer) o Bill balance (numeric) o EmailAddress (String) o 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 that 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: o Instance variables o Constructors o Accessor and mutator methods o Suitable toString( ) methods o Any other appropriate methods ? Write a class LabExam which utilizes the following: o An Array of Customer objects o A method that reads the input file provided and stores the objects in the array of Customers. o A method that sorts the array of Customers in ascending order by the customer ID. (you may use Arrays.sort(custList)) o A method that formats and prints the output report. 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 45 Customers per page. ? All money amounts and percentages should be displayed with 2 decimal places and commas after each thousand. o 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. o Any other helper methods used to meet the requirements of the assignment. o The main method will call all the other methods that will: ? Read the text file and store the objects in the array ? Sort the objects ? Format and print the report
Answers
As per your requirement the below one is solution please follow it step by step
Customer.java
package myPackage;
public class Customer {
private String custName;
private int custID;
private double balance;
private String email;
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
public int getCustID() {
return custID;
}
public void setCustID(int custID) {
this.custID = custID;
}
public double getBalance() {
return balance;
}
public Customer(String custName, int custID, double balance, String email) {
this.custName = custName;
this.custID = custID;
this.balance = balance;
this.email = email;
}
@Override
public String toString() {
return "customer name:" + custName + ", customer ID:" + custID + ", balance:" + balance + ", email:" + email;
}
public void setBalance(double balance) {
this.balance = balance;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}}
ExemptCustomer.javapackage myPackage;
public class ExemptCustomer extends Customer {
private String liability;
public ExemptCustomer(String custName, int custID, double balance, String email, String liability) {
super(custName, custID, balance, email);
this.liability = liability;
}@Override
public String toString() {
return super.toString()+" liability:" + liability + "]";
}public String getLiability() {
return liability;
}public void setLiability(String liability) {
this.liability = liability;
}
}
NonExemptCustomer.javapackage myPackage;
public class NonExemptCustomer extends Customer {
private double liability;public NonExemptCustomer(String custName, int custID, double balance, String email, double liability) {
super(custName, custID, balance, email);
this.liability = liability;
}@Override
public String toString() {
return super.toString()+"liability:" + liability ;
}public double getLiability() {
return liability;
}public void setLiability(double liability) {
this.liability = liability;
}
}