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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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.java

package 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.java

package 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;
   }
  

}

Add a comment
Know the answer?
Add Answer to:
Write in java language ================== Office Supplies Inc., an office supply store, services many customers. As...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • entry level java program Office Supplies Inc, an office supply store, services many customers. As customers’...

    entry level java program 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 Inc bills their customers once each month. At the end of each month, the CEO 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...

  • Write a Java program to read customer details from an input text file corresponding to problem...

    Write a Java program to read customer details from an input text file corresponding to problem under PA07/Q1, Movie Ticketing System The input text file i.e. customers.txt has customer details in the following format: A sample data line is provided below. “John Doe”, 1234, “Movie 1”, 12.99, 1.99, 2.15, 13.99 Customer Name Member ID Movie Name Ticket Cost Total Discount Sales Tax Net Movie Ticket Cost Note: if a customer is non-member, then the corresponding memberID field is empty in...

  • Office supply store: South of Fifth Copy Boutique is a small office supplies/office services store that...

    Office supply store: South of Fifth Copy Boutique is a small office supplies/office services store that sells stationery and mailing supplies, such as envelopes, paper boxes, pens, tape, etc. It also has a two printers, a scanner, and two copy machines that customers can use on a first-come first-serve basis, or reserve them in advance in 15 minute blocks of time. The owner is also a general manager and runs the operations, and employs one part-time worker who is usually...

  • ( Object array + input) Write a Java program to meet the following requirements: 1. Define...

    ( Object array + input) Write a Java program to meet the following requirements: 1. Define a class called Student which contains: 1.1 data fields: a. An integer data field contains student id b. Two String data fields named firstname and lastname c. A String data field contains student’s email address 1.2 methods: a. A no-arg constructor that will create a default student object. b. A constructor that creates a student with the specified student id, firstname, lastname and email_address...

  • Please run the program and show the result with screenshots after. Thank you (Java Eclipse) Customer...

    Please run the program and show the result with screenshots after. Thank you (Java Eclipse) Customer Data: Area Codes Assume you work for a company that tracks customer information, including name, gender and phone numbers Your company has a file called customers.txt which contains the following information: Jiming Wu F 4082123458 James Brown M 8315678432 Leanna Perez F 4087654433 Xing Li M 8313214555 Stacey Cahill O 8312123333 Mohammed Abbas M 4083134444 Kumari Chakrabarti F 4086667777 Shakil Smith M 4082123333 Jung...

  • Needs Help with Java programming language For this assignment, you need to write a simulation program...

    Needs Help with Java programming language For this assignment, you need to write a simulation program to determine the average waiting time at a grocery store checkout while varying the number of customers and the number of checkout lanes. Classes needed: SortedLinked List: Implement a generic sorted singly-linked list which contains all of the elements included in the unsorted linked list developed in class, but modifies it in the following way: • delete the addfirst, addlast, and add(index) methods and...

  • The purpose of this project is to give students more exposure to object oriented design and...

    The purpose of this project is to give students more exposure to object oriented design and programming using classes and polymorphism in a realistic application that involves arrays of objects and sorting arrays containing objects A large veterinarian services many pets and their owners. As new pets are added to the population of pets being serviced, their information is entered into a flat text file. Each month the vet requests and updates listing of all pets sorted by their "outstanding...

  • Write code in Java programming language. The ShoppingCart class will be composed with an array of...

    Write code in Java programming language. The ShoppingCart class will be composed with an array of Item objects. You do not need to implement the Item class for this question, only use it. Item has a getPrice() method that returns a float and a one-argument constructor that takes a float that specifies the price. The ShoppingCart class should have: Constructors: A no-argument and a single argument that takes an array of Items. Fields: • Items: an array of Item objects...

  • In Java programming language Please write code for the 6 methods below: Assume that Student class...

    In Java programming language Please write code for the 6 methods below: Assume that Student class has name, age, gpa, and major, constructor to initialize all data, method toString() to return string reresentation of student objects, getter methods to get age, major, and gpa, setter method to set age to given input, and method isHonors that returns boolean value true for honors students and false otherwise. 1) Write a method that accepts an array of student objects, and n, the...

  • This assignment will continue our hardware store system. You will turn in a java file named...

    This assignment will continue our hardware store system. You will turn in a java file named "MyMethods.java". It will contain one class named "MyMethods". That class will contain three methods. These methods must be exactly as specified (including method names): getAnInt will return a value of type int, and take as an argument a string to prompt the user. The actual prompt presented to the user should include not only the string argument, but also the information that the user...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT