Phase 1

Primary Task Response: Within the Discussion Board area, write 400600 words that respond to the following questions with your thoughts, ideas, and comments. This will be the foundation for future discussions by your classmates. Be substantive and clear, and use examples to reinforce your ideas.

You will have to provide both GUI design and pseudocode for your primary Discussion Board response. The first step is to design a GUI to allow a user to enter sales representative data. For this task, you will design the GUI and develop pseudocode that will help you plan how the Swing application will respond to the user. You are not implementing your Java Swing application in Java at this time. You are planning which Java Swing components you will use for each value entered and each value displayed. You are encouraged to provide a sketch of your GUI to help explain your design.

You will also create pseudocode for each method that responds to user events. This means if you have a button(s) that should perform an action when it has been selected; you will develop the algorithm for the processing attached to this button using pseudocode.

GUI Design Requirements:

Explain which Swing components you will use for your GUI to meet the requirements, and give the reasons for each choice. You must also include at least one set of grouped radio buttons in your GUI.

Design a GUI that allows a user to enter the following:

  • 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, email, visit)

Include a QUIT button to exit the application and an ENTER button that causes the sales representatives data to be entered. Each item of data entered should be stored in a variable when the ENTER button is keyed. This will prepare the application for the next iteration of development.

Pseudocode:

  • Write your pseudocode to outline the actions that will occur when the QUIT button is selected.
  • Write your pseudocode to outline the actions that will occur when the ENTER button is selected.
  • This pseudocode will be used as the planning comments when it comes time to implement this Swing application. The pseudocode should be detailed and specific enough that for each line of pseudocode, approximately one Java statement can be used to code it. These design artifacts (GUI design and pseudocode) will be inserted into a design document to be reviewed by your classmates and submitted with the final application for the final task.

Contribution:

  • Cover page
  • GUI design
  • Pseudocode
  • Reference page

Please feel free to provide any references or experiences to support your proposed design.

Your proposed GUI design has been approved by management. Management is confident that this will help them determine the effectiveness of their sales force. They are ready to have you implement the GUI. Before designing the application further, they want to first have the GUI implemented to perform very basic functionality. As you progress through the assignments, your submission will culminate in a Final Key Assignment.

Application Requirements:

Implement the Swing application using the GUI you designed in the Phase 1 Discussion Board. The user will have 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)

Include a QUIT button to exit the application and an ENTER button that causes the sales representatives data to be retrieved from the GUI components and submitted to the application. The sales representatives data will echo to the jTextArea each time the ENTER button is pressed.

Your application should be thoroughly commented.

Phase 2

Now that you have your GUI operational, it is time to take the application a step further. Management would like you to write the entered data into a file. They intend to use an application to read this file, evaluate the entered data, and display results. These results will help management to make decisions on sales force direction and expansion. Each time the ENTER button is pressed, the entered sales representatives data will be written out to a file. A new button, EVALUATE will be added that reads in the sales representatives data file after it has been created.

Design Requirements:

You must use pseudocode to design your algorithm for the ENTER button functionality. These design artifacts (pseudocode) will be inserted into a design document to be reviewed by your classmates and submitted with the final application for the final task.

Application Requirements:

Expand your Swing application to write the entered data out to a text file. Instead of displaying the data in the jTextArea when ENTER is pressed, change this functionality so that the data is written to a file. Name the output file salesrep.txt. Each time the ENTER button is pressed, the data will be written to the file. 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. The 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 file:

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. When the application starts, the file should be opened for appending. This file is to keep a running history of the entered data.

Intermediate-level Java programming should be demonstrated:

  • Program flow should be logical.
  • Projects should be developed in NetBeans and zipped prior to submission.
  • Your application should execute by running the main project.

Phase 3

It is time to enhance the application to read the sales representative data file and process. They are interested in identifying their star performers in their sales force. Management would like to create a group of these star performers for a few reasons. They would like these stars to mentor the rest of the sales force, and they would like to reward their success. Sales representatives in the stars group have sold at least $8,000 in products.

Application requirements:

Expand your application to include an EVALUATE button. Each time the EVALUATE button is selected, the sales representative data will be read 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 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. The 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

This functionality is in addition to functionality coded for the previous assignments. The application is enhanced with additional functionality during each iteration phase.

Be sure you use the debugger if at first you do not observe the results expected.

Intermediate-level Java programming should be demonstrated:

  • Program flow should be logical.
  • Projects should be developed in NetBeans and zipped prior to submission.
  • Your application should execute by running the main project.

Phase 4

Management would like to easily view the sales representative stars through the application. Your technical lead has imposed a design requirement. They want you to use an ArrayList in your solution. Before you begin coding this enhancement, you need to design your solution.

Design Documentation:

You must use an ArrayList provided by the Java API. You must first use pseudocode to work out your algorithm and create a class diagram of the system. The class diagram will include your Sales Representative class. These design artifacts (pseudocode and class diagram) will be inserted into a design document to be reviewed by your classmates and submitted with the final application for the final task.

Compile all of your pseudocode from the earlier IPs into the Design Document. Your Design Document should have a section that includes the functional requirements and any class diagrams used to describe the system. Include any design requirements imposed by your technical leadership. This will become your Key Assignment Draft which will be submitted in the Discussion Board for this week.

Application Requirements:

Enhance your application by creating 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 the toString() method to provide a readable string representation of the 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 Constraint:

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.

Phase 5

You will reuse some of the code developed in the earlier projects to implement a sophisticated Swing application that allows a user to enter and analyze sales representative data.

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 representatives 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 companys 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.

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. Answer the questions True or False.

1.The Formatter class allows you to append to a file.

2.Example syntax for opening a file for reading is: Scanner sc = new Scanner(sales.txt");

3.The Scanner class allows you to parse your input file as you read it in.

4.In the Java API, Maps inherit from the interface Collection.

5.You could use Collections.sort() to sort a HashSet.

6.Implementations of the Map interface provided by the Java API include WeakHashMap and HashTable.

7.The length() method for ArrayList will return the number of elements in the list.

8.You need to provide an estimate on the maximum number of elements you might store in an ArrayList when allocating memory for an ArrayList.

9.Duplicate keys are allowed in a TreeMap.

10.Before inserting a value into a TreeSet, you need to make sure it hasnt already been added to the TreeSet.

11.You cannot store user-defined objects into an ArrayList.

12.Example syntax for opening a file for reading is: BufferedReader in = new BufferedReader(new FileReader("stars.txt"));

13.FileWriter allows you to append to a file.

14.The setText() method can be used to set the value of a jTextField.

15.The isSelected() method can be used to determine if a jRadioButton has been selected.

16.A Swing application uses GUI components from the java.swing package.

17.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).

18.You could use the printf() method to write formatted output to a file if you use PrintWriter.

19.You could use the hasNext() method on the Scanner class to see if you had more data to read in.

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

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.