Question

#### All Subjects Computer Science Algorithms

Offered Price \$120.00

# CMIS242 project 1-4

Question # 00605316
Subject: Computer Science
Due on: 10/18/2017
Posted On: 10/18/2017 03:38 AM

Rating:
4.1/5
Posted By
Questions:
9600
Tutorials:
14233
Feedback Score:

Question

Project 1

The first programming project involves writing a program that computes the salaries for a collection of employees of different types. This program consists of four classes.

1. The first class is the Employee class, which contains the employee's name and monthly salary, which is specified in whole dollars. It should have three methods:

a. A constructor that allows the name and monthly salary to be initialized.

b. A method named annualSalary that returns the salary for a whole year.

c. A toString method that returns a string containing the name and monthly salary, appropriately labeled.

2. The Employee class has two subclasses. The first is Salesman. It has an additional instance variable that contains the annual sales in whole dollars for that salesman. It should have the same three methods:

a. A constructor that allows the name, monthly salary and annual sales to be initialized.

b. An overridden method annualSalary that returns the salary for a whole year. The salary for a salesman consists of the base salary computed from the monthly salary plus a commission. The commission is computed as 2% of that salesman's annual sales. The maximum commission a salesman can earn is \$20,000.

c. An overridden toString method that returns a string containing the name, monthly salary and annual sales, appropriately labeled.

3. The second subclass is Executive. It has an additional instance variable that reflects the current stock price. It should have the same three methods:

a. A constructor that allows the name, monthly salary and stock price to be initialized.

b. An overridden method annualSalary that returns the salary for a whole year. The salary for an executive consists of the base salary computed from the monthly salary plus a bonus. The bonus is \$30,000 if the current stock price is greater than \$50 and nothing otherwise.

c. An overridden toString method that returns a string containing the name, monthly salary and stock price, appropriately labeled.

4. Finally there should be a fourth class that contains the main method. It should read in employee information from a text file. Each line of the text file will represent the information for one employee for one year. An example of how the text file will look is shown below:

2014 Employee Smith,John 2000

2015 Salesman Jones,Bill 3000 100000

2014 Executive Bush,George 5000 55

The year is the first data element on the line. The file will contain employee information for only two years: 2014 and 2015. Next is the type of the employee followed by the employee name and the monthly salary. For salesmen, the final value is their annual sales and for executives the stock price. As the employees are read in, Employee objects of the appropriate type should be created and they should be stored in one of two arrays depending upon the year. You may assume that the file will contain no more than ten employee records for each year and that the data in the file will be formatted correctly.

Once all the employee data is read in, a report should be displayed on the console for each of the two years. Each line of the report should contain all original data supplied for each employee together with

1

that employee's annual salary for the year. For each of the two years, an average of all salaries for all employees for that year should be computed and displayed.

The google recommended Java style guide, provided as link in the week 2 content, should be used to format and document your code. Specifically, the following style guide attributes should be addressed:

Header comments include filename, author, date and brief purpose of the program. In-line comments used to describe major functionality of the code.

Meaningful variable names and prompts applied. Class names are written in UpperCamelCase.

Variable names are written in lowerCamelCase. Constant names are in written in All Capitals.

Braces use K&R style.

In addition the following design constraints should be followed:

Declare all instance variables private Avoid the duplication of code

Test cases should be supplied in the form of table with columns indicating the input values, expected output, actual output and if the test case passed or failed. This table should contain 4 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different kinds of employees to completely test the program.

Note: All code should compile and run without issue.

Submission requirements

Deliverables include all Java files (.java) and a single word (or PDF) document. The Java files should be named appropriately for your applications. The word (or PDF) document should include screen captures showing the successful compiling and running of each of the test cases. Each screen capture should be properly labeled clearly indicated what the screen capture represents. The test cases table should be included in your word or PDF document and properly labeled as well.

Submit your files to the Project 1 assignment area no later than the due date listed in your LEO classroom. You should include your name and P1 in your word (or PDF) file submitted (e.g. firstnamelastnameP1.docx or firstnamelastnameP1.pdf)

Project 2

This project involves writing a program that implements an ATM machine. The interface to the program should be a Java GUI that looks similar to the following:

.jpg">

The program should consist of three classes.

1. The first class should define the GUI. In addition to the main method and a constructor to build the GUI, event handlers will be needed to handle each of the four buttons shown above. When the Withdraw button is clicked, several checks must be made. The first check is to ensure the value in the text field is numeric. Next a check must be made to ensure the amount is in increments of \$20. At that point an attempt to withdraw the funds is made from the account selected by the radio buttons. The attempt might result in an exception being thrown for insufficient funds, If any of those three errors occur a

JOptionPane window should be displayed explaining the error. Otherwise a windowshould be displayed confirming that the withdrawal has succeeded. When the Deposit button is clicked the only necessary check is to ensure that the amount input in the textfield is numeric. Clicking the Transfer button signifies transferring funds to the selected account from the other account. The checks needed are to confirm that the amount supplied is numeric and that there are sufficient funds in the account from which the funds are being transferred. Clicking the Balance button will cause aJOptionPane window to be displayed showing the current balance in the selected account. The main class must contain twoAccount objects, one for the checking account and another for the savings account.

1. The second class isAccount. It must have a constructor plus a method that corresponds to each of the four buttons in the GUI. It must also incorporate logic to deduct a service charge of \$1.50 when more than four total withdrawals are made from either account.

Note that this means, for example, if two withdrawals are made from the checking and two from the savings, any withdrawal from either account thereafter incurs the service charge. The method that performs the withdrawals must throw anInsufficientFunds exception whenever an attempt is made to withdraw more funds than are available in the

1

account. Note that when service charges apply, there must also be sufficient funds to pay for that charge.

3. The third class isInsufficientFunds, which is a user defined checked exception.

The google recommended Java style guide, provided as link in the week 2 content, should be used to format and document your code. Specifically, the following style guide attributes should be addressed:

Header comments include filename, author, date and brief purpose of the program. In-line comments used to describe major functionality of the code.

Meaningful variable names and prompts applied. Class names are written in UpperCamelCase.

Variable names are written in lowerCamelCase. Constant names are in written in All Capitals.

Braces use K&R style.

In addition the following design constraints should be followed:

Declare all instance variables private Avoid the duplication of code

Test cases should be supplied in the form of table with columns indicating the input values, expected output, actual output and if the test case passed or failed. This table should contain 4 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different scenarios to completely test the program.

Note: All code should compile and run without issue.

Submission requirements

Deliverables include all Java files (.java) and a single word (or PDF) document. The Java files should be named appropriately for your applications. The word (or PDF) document should include screen captures showing the successful compiling and running of each of the test cases. Each screen capture should be properly labeled clearly indicated what the screen capture represents. The test cases table should be included in your word or PDF document and properly labeled as well.

Submit your files to the Project 2 assignment area no later than the due date listed in your LEO classroom. You should include your name and P2 in your word (or PDF) file submitted (e.g. firstnamelastnameP2.docx or firstnamelastnameP2.pdf).

Project 3

This programming project involves writing a program to calculate the terms of the following sequence of numbers: 0 1 2 5 12 29 ... where each term of the sequence is twice the previous term plus the second previous term. The 0th term of the sequence is 0 and the 1st term of the sequence is 1.

For example:

0 1 2 -> (0 + 1 + 2) + 2 = 5

0 1 2 5 -> (0 + 1 + 2 + 5) + 5 = 12

0 1 2 5 12 -> (0 + 1 + 2 + 5 + 12) + 12 = 29

The interface to the program should be a GUI that looks similar to the following:

.jpg">

The pair of radio buttons allows the user to choose whether an iterative or recursive method is used to compute the term of the sequence. When the user enters a value for n and then clicks the Compute button, the nth term of the sequence should be displayed in the Result field. The Efficiency field should contain the number of calls to the recursive method when the recursive option is chosen and the number of iterations of the loop when the iterative option is selected.

The Iterative radio button should be initially set to selected.

When the window is closed, the efficiency values should be computed with values of n from 0 to 10 and written to a file. Each line of the file should contain the value of n, the efficiency of the iterative method for that value of n and the efficiency of the recursive method. The values should be separated by commas so the file can be opened with Excel and used to graph the value of the efficiencies for both the iterative and recursive options along the y axis with the value of n along the x-axis. The graph should be included in the Word document that accompanies this project and should also contain a brief explanation of the observed results.

The program should consist of two classes.

The first class should define the GUI. In addition to the main method and a constructor to build the GUI, an event handler will be needed to handle the Compute button click and another handler will be needed to produce the file described above when the window is closed. The latter handler should be an object of an inner class that extends the WindowAdapter class.

1

2. The other class should be named Sequence. It should be a utility class meaning that all its methods must be class (static) methods and no objects should be able to be generated for that class. It should contain three public methods:

a. The first method computeIterative should accept a value of n and return the corresponding element in the sequence using iteration.

b. The second method computeRecursive should accept a value of n and return the corresponding element in the sequence using recursion. This method will be a helper method because it will need to initialize the efficiency counter before calling the private recursive method that will actually perform the recursive computation.

c. The third method getEfficiency will return the efficiency counter left behind by the previous call to either of the above two methods.

The google recommended Java style guide, provided as link in the week 2 content, should be used to format and document your code. Specifically, the following style guide attributes should be addressed:

· Header comments include filename, author, date and brief purpose of the program.

· In-line comments used to describe major functionality of the code.

· Meaningful variable names and prompts applied.

· Class names are written in UpperCamelCase.

· Variable names are written in lowerCamelCase.

· Constant names are in written in All Capitals.

· Braces use K&R style.

In addition the following design constraints should be followed:

Declare all instance variables private

Avoid the duplication of code

Test cases should be supplied in the form of table with columns indicating the input values, expected output, actual output and if the test case passed or failed. This table should contain 4 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different scenarios to completely test the program.

Note: All code should compile and run without issue.

Submission requirements

Deliverables include all Java files (.java) and a single word (or PDF) document. The Java files should be named appropriately for your applications. The word (or PDF) document should include screen captures showing the successful compiling and running of each of the test cases. Each screen capture should be properly labeled clearly indicated what the screen capture represents. The test cases table should be included in your word or PDF document and properly labeled as well.

Submit your files to the Project 3 assignment area no later than the due date listed in your LEO classroom.

You should include your name and P3 in your word (or PDF) file submitted (e.g.

firstnamelastnameP3.docx or firstnamelastnameP3.pdf).

2

Project 4

This programming project involves writing a program to manage a student database. The interface to the program should be a GUI that looks similar to the following:

.jpg">

A combo box should allow the user to select one of the four database actions shown. The database should be implemented as a HashMap, with the ID field as the key and a student record consisting of a name and major as the value. The operation should be performed when the user clicks the Process Requestbutton. If the user attempts to insert a key that is already in the database an error messageshould be displayed using a JOptionPane message dialog box. If the user attempts to delete, find or update a record that is not in the database, a message should also be displayed. After each successful operation is completed a JOptionPane window should be displayed confirming the success. In the case of a successful Find request, a window should pop up containing the student's ID, name, major and current GPA. When the user selects the Update request, the following JOptionPane windows should be displayed to gather information about a course that has just been completed:

.jpg">

1

This program must consist of two classes.

1. The first class should define the GUI and handle the database interactions.

1. The second class named Student, should define the student record. It must have instance variables for the student name, major and two variables that are used to compute the GPA. A variable that contains the total number of credits completed and a second variable that contains the total quality points, which are the numeric value of the grade received in a course times the number of credit hours. It should not contain the student ID. The class should have the following three methods:

A constructor that is used when new student records are created. It should accept the name and major as parameters and initialize the fields that are used to compute the GPA to zero.

The second method courseCompleted should accept the course grade and credit hours and update the variables used to compute the GPA. It will be called when an Update request is made.

The third method should override toString and return a labeled string containing the student name, major and GPA.

Finally when a student has not yet completed any course, the GPA should be displayed as 4.0.

The google recommended Java style guide, provided as link in the week 2 content, should be used to format and document your code. Specifically, the following style guide attributes should be addressed:

Header comments include filename, author, date and brief purpose of the program.

In-line comments used to describe major functionality of the code.

Meaningful variable names and prompts applied.

Class names are written in UpperCamelCase.

Variable names are written in lowerCamelCase.

Constant names are in written in All Capitals.

Braces use K&R style.

In addition the following design constraints should be followed:

3. Declare all instance variables private

4. Avoid the duplication of code

5. Also any exceptions thrown by nonnumeric inputs should be properly handled

Test cases should be supplied in the form of table with columns indicating the input values, expected output, actual output and if the test case passed or failed. This table should contain 4 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different scenarios to completely test the program.

Note: All code should compile and run without issue.

2

Submission requirements

Deliverables include all Java files (.java) and a single word (or PDF) document. The Java files should be named appropriately for your applications. The word (or PDF) document should include screen captures showing the successful compiling and running of each of the test cases. Each screen capture should be properly labeled clearly indicated what the screen capture represents. The test cases table should be included in your word or PDF document and properly labeled as well.

Submit your files to the Project 4 assignment area no later than the due date listed in your LEO classroom. You should include your name and P4 in your word (or PDF) file submitted (e.g. firstnamelastnameP4.docx or firstnamelastnameP4.pdf).

Tutorials for this Question
Available for
\$150.00

#### CMIS242 project 1-4

Tutorial # 00603796
Posted On: 10/18/2017 03:38 AM
Posted By:
neil2103
Questions:
9600
Tutorials:
14233
Feedback Score:
Tutorial Preview …1-4CMIS242…
Attachments
project_1.zip (42.32 KB)
porjcet_2.zip (117.76 KB)
prjcet_3.zip (179.36 KB)
project_4.zip (138.38 KB)
* - Additional Paypal / Transaction Handling Fee (3.9% of Tutorial price + \$0.30) applicable