Details of this Paper

Week 5 Java Programming II final

Description

solution


Question

GUI requirements;The Swing application will provide a GUI that allows a user to enter the following data items;Sales representative ID;Sales representative First Name;Sales representative Last Name;Total sold for each of three categories: office supplies, books, and paper;Sales district (North, South, East, West);Preferred means of contact with potential buyers (phone, e-mail, visit);The Swing application will contain the appropriate GUI components to enter the sales information and provide buttons QUIT, ENTER, EVALUATE, and DISPLAY.;QUIT Button Requirements;Provide a QUIT button to exit the application.;ENTER Button Requirements;Create an ENTER button that causes the sales representative?s data to be retrieved from the GUI components and submitted to the application. Each time the ENTER button is pressed, the data will be written to the file. Name the output file salesrep.txt.;Write the data in the following format to a text file, using white spaces as the delimiter. Include the categories (SUPPLIES, BOOKS, PAPER) in your file to label the dollar amount sold for each category. Sales district entered should be converted to upper case (NORTH, SOUTH, EAST, WEST). Independent line separators should be used in the output file. Code for the ENTER button should be well commented.;Format of your output file, salesrep.txt;salesRepID firstName lastName SUPPLIES totalAmountSuppliesSold BOOKS totalAmountBooksSold PAPER totalAmountPaperSold district contactMeans;Example output file contents;1001 Jennifer Ward SUPPLIES 2140.20 BOOKS 5200.10 PAPER 455.23 NORTH Phone;1003 Athena Andrews SUPPLIES 5155.55 BOOKS 6300.50 PAPER 223.25 SOUTH Email;Each time the ENTER button is pressed, the application should append a new line to the file, salesrep.txt. When the application starts, the file should be opened for appending. This file is to keep a running history of the entered data.;EVALUATE Button Requirements;Provide an EVALUATE button. Each time the EVALUATE button is selected, the sales representative data will be read from the output file, salesrep.txt, that was created and the amounts sold in SUPPLIES, BOOKS, and PAPER will be totaled. If the amount sold on all three categories is greater than or equal to (>=) $8,000, write the sales representative data to a new file stars.txt. These sales representatives will receive a bonus to demonstrate your company?s appreciation for a job well done.;Your stars.txt file should not be opened for appending each time the application is run. Independent line separators should be used in the output file. Code should be well commented.;An example of the format of your stars.txt file;salesrepID firstName lastName SUPPLIES totalAmountSuppliesSold BOOKS totalAmountBooksSold PAPER totalAmountPaperSold district contactMeans;DISPLAY Button Requirements;Create a DISPLAY button. When this button is selected, the stars.txt file will be read in and displayed. Create a Sales Representative class that stores sales representative information. A Sales Representative object will be created for each sales representative that is read in when the DISPLAY button is selected. Select appropriate attributes for your Sales Representative. Ensure that you have created appropriate constructor(s) that will allow you to create sales representatives with the values read in from the file for sales rep ID, sales rep first name, sales rep last name, and so on.;With each Sales Representative that is read in from your stars.txt input file, you will create a Representative object that holds the sales representative data and add each Representative object to an ArrayList. Do not store your sales representative information as a String and add this String into your ArrayList. You must use your Representative class to create Representative objects. You should store Representative objects that encapsulate your sales representative information and store these in your ArrayList.;Hint: You may want to look into overriding toString() method to provide a readable string representation of Representative object.;After the ArrayList has been created, this ArrayList will be iterated over and displayed to the jTextArea. Override the toString() method for your Representative class so that each sales representative is printed in a readable manner. Total sales representatives should also be displayed.;Design requirement: You must use an ArrayList to collect all Representative objects that represent the sales representative data in the file.;An example of the printing of the contents of the ArrayList;TOTAL SALES REPRESENTATIVES: 2;101 Jeannette Roberts;Supplies: 850.20;Books: 950.10;Paper: 855.23;SOUTH;PHONE;102 Anthony Laine;Supplies: 875.55;Books: 1000.50;Paper: 908.25;NORTH;EMAIL;Intermediate-level Java programming should be demonstrated in your application;There should be implemented constructors for each class.;The toString() method should be overridden to provide readable string representation of each object.;The getters and setters should be implemented to enforce data hiding.;The code should be fully commented.;The program flow should be logical.;Behavior should be encapsulated into methods avoiding all-encompassing large main() methods.;The project should be developed in NetBeans and zipped prior to submission.;The code should compile and run free of exceptions indicating that debugging tools were used to eliminate any run time errors.;Submit a zipped NetBeans project and a design document that contains a description of the system, your GUI design, and the pseudocode and class diagrams.;Competency Test;The second part of the key assignment is a competency test that will test you on debugging tools, commenting and structuring programs properly, and Java Swing events, event handling, streaming, file processing, and data structure. If you do not pass this competency exam, you will not be able to proceed to IT351. Answer the questions True or False.;The Formatter class allows you to append to a file.;Example syntax for opening a file for reading is: Scanner sc = new Scanner(?sales.txt");The Scanner class allows you to parse your input file as you read it in.;In the Java API, Maps inherit from the interface Collection.;You could use Collections.sort() to sort a HashSet.;Implementations of the Map interface provided by the Java API include WeakHashMap and HashTable.;The length() method for ArrayList will return the number of elements in the list.;You need to provide an estimate on the maximum number of elements you might store in an ArrayList when allocating memory for an ArrayList.;Duplicate keys are allowed in a TreeMap.;Before inserting a value into a TreeSet, you need to make sure it hasn?t already been added to the TreeSet.;You cannot store user-defined objects into an ArrayList.;Example syntax for opening a file for reading is: BufferedReader in;= new BufferedReader(new FileReader("stars.txt"));FileWriter allows you to append to a file.;The setText() method can be used to set the value of a jTextField.;The isSelected() method can be used to determine if a jRadioButton has been selected.;A Swing application uses GUI components from the java.swing package.;To write out a platform independent line separator to a file, you could write out the String that is returned from System.getProperty (?line.separator?).;You could use the printf() method to write formatted output to a file if you use PrintWriter.;You could use the hasNext() method on the Scanner class to see if you had more data to read in.;You could use the value returned from the getText() method on the jTextField class in a mathematical operation without first converting to a numeric type.;Please submit your assignment.

 

Paper#70810 | Written in 18-Jul-2015

Price : $27
SiteLock