I need help with a program for my Java 2 class

I have submitted the two pdfs with instructions. Use the code given to complete the assignment.

Get Help With a similar task to - I need help with a program for my Java 2 class

Login to view and/or buy answers.. or post an answer
Additional Instructions:

+ CPS 2231-#2&#9 Computer Organization & Programming 2020 Spring Dr. Wai Tak Wong Lab test #5 Assigned: April 23, 2020 Due: Upload to Blackboard on April 23, 2020 at the end of the class. Score: 15pts Follow the Best Office Supplies.pdf document to think about the output of the report and implement at home. In the class, I’ll give you half cooked program which handles the input file read from the given custlist.txt and EOF situation. You will have a string for each line read. The customer class definition is also given. You should complete the coding according to project description according to Best Office Supplies.pdf and follow my codes. Two more documents link are given for your reference. About the String format and the scanner to read from string. https://docs.oracle.com/javase/tutorial/java/data/numberformat.html https://www.javatpoint.com/Scanner-class wai-takwong Highlight

LabTest5/.DS_Store LabTest5/custlist2.txt 10 900 Amazon purchasing@amazon.com 20000.0 0.08 210 Nordstrom purchasing@nordstrom.com 50000.0 0.07 10 Rutgers purchasing@rutgers.edu 32000.0 education 520 Alamo purchasing@alamo.com 23000.0 0.05 1 Kean purchasing@kean.edu 158000.5 education 100 Allied purchasing@allied.com 85300.0 0.06 950 JoesInc purchasing@joesinc.com 999999.0 0.03 210 Nordstrom purchasing@nordstrom.com 5000.0 0.07 10 Rutgers purchasing@rutgers.edu 3200.0 education 520 Alamo purchasing@alamo.com 2300.0 0.05 LabTest5/.classpath LabTest5/custlist.txt 100 900 Amazon purchasing@amazon.com 20000.0 0.08 210 Nordstrom purchasing@nordstrom.com 50000.0 0.07 10 Rutgers purchasing@rutgers.edu 32000.0 education 520 Alamo purchasing@alamo.com 23000.0 0.05 1 Kean purchasing@kean.edu 158000.5 education 100 Allied purchasing@allied.com 85300.0 0.06 950 JoesInc purchasing@joesinc.com 999999.0 0.03 697 BostonU purchasing@tufts.edu 340020.23 education 310 TruckersInc purchasing@truckersinc.com 55000.0 0.10 820 Clothiers purchasing@clothiers.com 20044.0 0.05 849 RedCross purchasing@redcross.org 48900.2 non-profit 125 ChocolateRus purchasing@chocolate.com 3000.5 0.1 535 CareBear purchasing@carebear.com 6000.0 0.08 331 BalloonInc purchasing@balloon.com 5100.5 0.06 345 TiresInc purchasing@tires.com 25000.0 0.07 211 JeweleryInc purchasing@jewelery.com 52000.0 0.08 2 Vassar purchasing@vassar.edu 53000.0 education 521 Hertz purchasing@hertz.com 22200.0 0.07 9 JCU purchasing@jcu.edu 135678.5 education 120 Enterprise purchasing@enterprise.com 75300.0 0.06 958 Avis purchasing@avis.com 89999.0 0.03 699 Tufts purchasing@tufts.edu 340020.23 education 910 Truckers2Corp purchasing@truckers2corp.com 55000.0 0.10 825 LandsEnd purchasing@landsend.com 20054.0 0.04 853 TheFutureProject purchasing@tfp.org 48920.2 other 225 Bromilows purchasing@bromilows.com 3300.5 0.5 539 Thrifty purchasing@thrify.com 6600.0 0.07 339 FlowersRus purchasing@flowers.com 59300.5 0.08 660 Prudential purchasing@prudential.com 28900.0 0.07 567 MassMutual purchasing@massmutual.com 5890.0 0.08 111 Montclair purchasing@montclair.edu 39800.0 education 578 SaveTheChildren purchasing@savechildren.com 28760.0 non-profit 154 NJDOE purchasing@njdoe.gov 158000.5 other 333 ShopRite purchasing@shoprite.com 82100.0 0.07 943 Turtles purchasing@turtles.com 88888.0 0.08 901 Brandeis purchasing@brandeis.edu 340020.23 education 610 TruckersRus purchasing@truckersrus.com 54000.0 0.08 821 Clothier&Son purchasing@clothiersson.com 20044.0 0.05 823 MLH purchasing@mlh.org 900.2 other 725 Calandras purchasing@calandra.com 43000.5 0.7 536 PinkElephant purchasing@pinkelephant.com 600.0 0.05 338 Essie purchasing@essie.com 5000.5 0.07 348 Uber purchasing@uber.com 1500.0 0.05 157 NYDOE purchasing@nydoe.gov 12000.5 other 213 Zales purchasing@zales.com 54300.0 0.07 322 Columbia purchasing@columbia.edu 54500.0 education 555 CheapCars purchasing@cheapcars.com 23210.0 0.09 99 NJIT purchasing@NJIT.edu 13978.5 education 358 DAV purchasing@dav.org 4860.2 non-profit 852 LLBean purchasing@llbean.com 2234.0 0.03 238 ArthritisREU purchasing@arthritisreu.org 4890.2 other 902 Etsy purchasing@etsy.com 20400.0 0.03 212 BedBath purchasing@Bedbath.com 55000.0 0.05 11 UPenn purchasing@upenn.edu 350000.0 education 522 EnginesRus purchasing@enginesrus.com 23500.0 0.06 8 SetonHall purchasing@setonhall.edu 158090.5 education 108 TiresToGo purchasing@tirestogo.com 8300.0 0.06 956 BillShop purchasing@billshop.com 9999.0 0.08 798 NorthEastern purchasing@northeastern.edu 40020.23 education 318 Chocolatiers purchasing@chocolatiers.com 59000.0 0.03 819 DunkinDonuts purchasing@dunkingdonuts.com 2044.0 0.06 850 DiabetesOrg purchasing@diabetes.org 4900.2 non-profit 126 Beans purchasing@beans.com 1000.5 0.03 538 BabyGap purchasing@babygap.com 6100.0 0.07 334 PartyStore purchasing@partystore.com 500.5 0.03 349 Threads purchasing@threads.com 29000.0 0.05 218 ColorsInc purchasing@colorsinc.com 2000.0 0.06 12 CountyCollege1 purchasing@cc1.edu 5000.0 education 531 BusinessRUs purchasing@businessrus.com 1200.0 0.08 109 CountyCollege2 purchasing@cc2.edu 1678.5 education 128 Business2 purchasing@business2.com 5300.0 0.02 959 Oleander purchasing@oleander.com 2999.0 0.04 698 Harvard purchasing@harvard.edu 34020.23 education 914 TaxisInc purchasing@taxisinc.com 5000.0 0.09 829 Jjill purchasing@jjill.com 2054.0 0.05 859 CSTA purchasing@csta.org 4820.2 other 229 Godiva purchasing@godiva.com 3100.5 0.06 540 DryCleaners purchasing@drycleaners.com 6800.0 0.05 332 Macys purchasing@macys.com 58200.5 0.07 669 CADOE purchasing@cadoe.gov.com 2900.0 other 561 Prudential purchasing@prudential.com 58290.0 0.07 112 Linden purchasing@linden.gov 3800.0 other 579 FoodPantry purchasing@foodpantry.org 25760.0 non-profit 159 WADOE purchasing@wadoe.gov 18000.5 other 377 StopandShop purchasing@stopandshop.com 8100.0 0.06 953 WholeFoods purchasing@wholefoods.com 8888.0 0.06 907 FIT purchasing@fit.edu 30020.23 education 690 CarRental1 purchasing@carrental1.com 5400.0 0.04 851 Office1 purchasing@office1.com 2044.0 0.05 822 CodeHS purchasing@codehs.org 1000.2 other 727 Bakery1 purchasing@bakery1.com 4000.5 0.07 539 BabyToys purchasing@babytoys.com 6000.0 0.04 3 Google purchasing@google.com 500.5 0.01 19 NYYankees purchasing@nyyankees.com 15500.0 0.07 155 Census purchasing@census.gov 102000.5 other 110 Fridays purchasing@fridays.com 5300.0 0.06 328 CUNY purchasing@cuny.edu 5500.0 education 551 CheapFood purchasing@cheapfood.com 2210.0 0.04 18 LegoInc purchasing@lego.com 1978.5 0.02 359 DAV2 purchasing@dav2.org 4860.2 non-profit LabTest5/.project LabTest5 org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature LabTest5/bin/.DS_Store LabTest5/bin/Process.class public synchronized class Process { public void Process(); public static void main(String[]); static Customer[] process_input(java.io.BufferedReader) throws java.io.IOException; static void process_output1(java.io.PrintWriter, Customer[]) throws java.io.IOException; static void process_output2(java.io.PrintWriter, Customer[]) throws java.io.IOException; static Customer scanObjectFromLine(String); } LabTest5/bin/TaxLiableCust.class public synchronized class TaxLiableCust extends Customer { private double rate; public double getRate(); public void setRate(double); public void TaxLiableCust(String, int, String, String, double, double); public String toString(); } LabTest5/bin/Customer.class public synchronized class Customer implements Comparable { private String name; private int id; private String email; private String taxType; private double balance; public String getName(); public void setName(String); public int getId(); public void setId(int); public String getEmail(); public void setEmail(String); public double getBalance(); public void setBalance(double); public String getTaxType(); public void setTaxType(String); public void Customer(String, int, String, String, double); public void Customer(); public int compareTo(Customer); } LabTest5/bin/NonProfitCust.class public synchronized class NonProfitCust extends Customer { public void NonProfitCust(String, int, String, String, double); public String toString(); } LabTest5/.settings/org.eclipse.jdt.core.prefs eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.8 LabTest5/src/.DS_Store LabTest5/src/Process.java LabTest5/src/Process.java import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; //Program work correctly with process_output1 will get 12 pts in Blackboard //Program work correctly with process_output2 requirement will get 3 more pts in Blackboard. public class Process {     public static void main(String []args) {         File inputFile = new File("custlist2.txt");         if (!inputFile.exists()) {             System.out.println("Input file custlist.txt not exist");             System.exit(-1);         }         try(            BufferedReader br = new BufferedReader(new FileReader(inputFile));            PrintWriter bw = new PrintWriter(System.out);         ){            Customer[] customers = process_input(br);            Arrays.sort(customers);            process_output1(bw, customers);            //process_output2(bw, customers);                      } catch (FileNotFoundException e) {             // TODO Auto-generated catch block             e.printStackTrace();         } catch (IOException e) {             // TODO Auto-generated catch block             e.printStackTrace();         }     }          //Read text file from custlist.txt and return an array of customers     static Customer[] process_input(BufferedReader br) throws IOException {         String line = br.readLine();         int numberOfRecord = Integer.parseInt(line);         Customer[] customers = new Customer[numberOfRecord];         int index = 0;         while ((line=br.readLine()) != null) {             //Scan one line and get the customer object and set its index in the array.             customers[index] = scanObjectFromLine(line);             index++;         }         // return an array of customer instances         return customers;     }          //Customer has only one record in the custlist.txt     static void process_output1(PrintWriter bw, Customer[] customers) throws IOException {         //Implement the print out for the report according to the project required format         for (Customer customer : customers) {             bw.write(customer.toString());         }     }          //Customer have more than one records in the custlist2.txt     //You need to add the balance together and compute the tax amount before you print the record.     //There are only one record for each customer     static void process_output2(PrintWriter bw, Customer[] customers) throws IOException {         //Implement the print out report according to the project required format         for (Customer customer : customers) {             bw.write(customer.toString());         }     }          static Customer scanObjectFromLine(String line) {         Scanner scanner = new Scanner(line);         //get the data from scanner by using next??? methods for name, id, balance, email and Tax liability         //distinguish the Tax liability to set the taxType and create          //the corresponding TaxiableCust o NonProfitCust instance         int id=0;         String name="" ;         String email="" ;         double balance=0;         String liability="" ;         String taxType="";         double rate=0;                  scanner.close();         //according to the taxType to create different type of object.         if (taxType.contentEquals("tax liable"))             return new TaxLiableCust(name, id, email, taxType, rate,  balance);         else             return new NonProfitCust(name, id, email, taxType,  balance);     }      } LabTest5/src/Customer.java LabTest5/src/Customer.java public class Customer implements Comparable<Customer> {     public String getName() {         return name;     }     public void setName(String name) {         this.name = name;     }     public int getId() {         return id;     }     public void setId(int id) {         this.id = id;     }     public String getEmail() {         return email;     }     public void setEmail(String email) {         this.email = email;     }     public double getBalance() {         return balance;     }     public void setBalance(double balance) {         this.balance = balance;     }     public String getTaxType() {         return taxType;     }     public void setTaxType(String taxType) {         this.taxType = taxType;     }          public Customer(String name, int id, String email, String taxType, double balance) {         this.name = name;         this.id = id;         this.email = email;         this.balance = balance;         this.taxType = taxType;     }     public Customer() {}     private String name;     private int id;     private String email;     private String taxType;     private double balance;     @Override     public int compareTo(Customer o) {         return (this.id > o.id)? 1 : ((this.id < o.id) ? -1 : 0);     } } LabTest5/src/TaxLiableCust.java LabTest5/src/TaxLiableCust.java import java.text.DecimalFormat; public class TaxLiableCust extends Customer {     private double rate;          public double getRate() {         return rate;     }     public void setRate(double rate) {         this.rate = rate;     }     public TaxLiableCust(String name, int id, String email, String taxType, double rate, double balance) {         //call super class constructor         super();     }          //Refer to https://docs.oracle.com/javase/tutorial/java/data/numberformat.html     public String toString() {         //calculate the taxAmount                  //implement toString() method so that it return the string fit the format of the report         return "";     } } LabTest5/src/NonProfitCust.java LabTest5/src/NonProfitCust.java public class NonProfitCust extends Customer {     public NonProfitCust(String name, int id, String email, String taxType, double balance) {         //call super class constructor     }     public String toString() {         //implement toString() method so that it return the string fit the format of the report         return "";     } }

CPS 2231/2020 Spring Computer Organization and Programming Program #5: Best Office Supplies Inc Due Date: As noted on Blackboard Concepts: Classes and objects, inheritance, polymorphism Point value: xxx points 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 Program 5. Please submit all classes in one file. The name of the physical program file submitted xxxx_program5, 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 named custlist.txt. 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 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: o Instance variables o Constructors CPS 2231/2020 Spring Computer Organization and Programming o Accessor and mutator methods o Suitable toString() methods o Any other appropriate methods  Write a class xxxx_program5 which utilizes the following: o An Array of Customer objects o A method which reads the input file provided and stores the objects in the array of Customers. o A method which sorts the array of Customers in ascending order by the customer ID. 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 which will:  Read the text file and store the objects in the array  Sort the objects  Format and print the report  Test the program so that there are no errors using the input file provided, program5.txt. Note that the program will only be tested using the file posted on Blackboard. You should not submit another file.  Record your planning time, coding time, testing time and bug fixing time. Include a comment with your name and this information at the top of the program.  Submit your program in one file, xxxx_program5, where xxxx is your Kean email id. CPS 2231/2020 Spring Computer Organization and Programming Sample Report Output: Note that lines have been omitted to show page headers. Your output does not have to match exactly but all information should be properly labeled, report headers and column headers displayed. Best Office Supplies Inc. Customer Report Page 1 ========================== Customer ID Email Address Balance Tax Type Tax Amount ======== == ============= ====== ====== ========== Threads2 001 purchasing@threads2.com 29,000.00 tax liable 1,450.00 DAV2 002 purchasing@dav2.org 4,860.20 non-profit DAV3 003 purchasing@dav3.org 4,860.20 non-profit StopandShop3 004 purchasing@stopandshop2.com 8,100.00 tax liable 486.00 Best Office Supplies Inc. Customer Report Page 2 ========================== Customer ID Email Address Balance Tax Type Tax Amount ======== == ============= ====== ====== ========== Threads 349 purchasing@threads.com 29,000.00 tax liable 1,450.00 DAV 358 purchasing@dav.org 4,860.20 non-profit DAV2 359 purchasing@dav2.org 4,860.20 non-profit StopandShop 377 purchasing@stopandshop.com 8,100.00 tax liable 486.00

Related Questions

Similar orders to I need help with a program for my Java 2 class
32
Views
0
Answers
Advance topics in machine learning (Kernels) 2 questions.
Any 2/3 Questions need answering on Advance topics in machine learning (Kernels). relevant notes can be shared upon request....
17
Views
0
Answers
Using R programming to perform functions and do work.
The expectations are to use R programming to answer the questions attached the file, and the result is also to be a .r file....
13
Views
0
Answers
write up a report using c programming.
Using the knowledge acquired from this module write a descriptive report to solve the programming problems listed below. The word count limit is 500 words You must include the full code implementation as appendix! I recommend you use Courier New size 1...
16
Views
0
Answers
Analyse requirements and select appropriate solutions. Design programmes that use appropriate data structures
The assignment requires you to select and implement appropriate data structures, design and implement algorithms and create the relevant software applications that will allow a user to store, update and manipulate the data relating to the operations of an...