# Project #39091 - Data Structures Java

This is a 2 Part Homework Assignment. Please approach both parts as separate programs that need to be build.

Write the below program is Java.

Also - solution can be easily found online but you need to use different algorithm. Teacher will catch that.

PART 1 PART 1 PART 1 PART 1 PART 1

 Instructions Polynomial Processing 1. Project SpecificationDesign, implement and test an object-oriented Java program for processing single-variable polynomials represented as ArrayLists. Consider polynomials with integer coefficients and positive integer exponents. Implement the operations of addition and subtraction of two polynomials. Read the polynomials from an input file (see Examples). A polynomial is represented in the input file by its name and a set of pairs of integers, each pair consisting of acoefficient and an exponent. The pairs of coefficients and exponents are listed in the decreasing order of the exponents. For example, P1;5;3;-4;1;8;0 represents the polynomial 5X^3 -4X + 8. After reading the polynomials, they will be displayed on the screen in human readable form (see Examples). A polynomial will always be displayed from the highest exponent to the lowest. A term having coefficient value zero will be omitted. The operations on polynomials will be entered by the user from the console (see Examples). After executing the required operation: (i) the program should store the new generated polynomial (to be further used in other operations), (ii) the result will be shown at the console in human readable form (see Examples) and (iii) the user will be allowed to specify another operation or to exit the program. Notes       1. You may assume that there are no errors in the input file structure.      2. The input file (a simple .txt file) should be generated by the students using a simple text editor           such as Notepad. 2. ExamplesExample of input file content: P1;5;3;-4;1;8;0P2;6;5;-2;2;7;1;-4;0Alpha;-4;3;7;2;-3;0 Example of the console output in human readable form: P1(X) = 5X^3 –4X +8P2(X) = 6X^5 -2X^2 +7X -4Alpha(X) = -4X^3 +7X^2 -3 Example of user specified operation: Please enter the first polynomial operand: P2Please enter the second polynomial operand: P1Please enter the operation: -Please enter the name of the new polynomial: P3Executing the operation ...P3(X) = 6X^5 -5X^3 -2X^2 +11X -12Do you want to continue (Y or N)?       3. Submission Requirements Submit the following before the due date listed in the Calendar: 1. All .java source files and the input file(s).2. A document file including relevant screenshots showing program execution as a result of test cases.3. A document file describing your solution which should include the following elements: (3.1) a short problem analysis, (3.2) main design decisions, (3.3) assumptions, (3.4) short description of classes, (3.5) user interface, (3.6) test plan, (3.7) error handling, (3.8) lessons learned and (3.9) possible future developments. The size of the document should be of 3 pages, single spaced, font size 12.

PART 2 PART 2 PART 2 PART 2 PART 2

Question 1

Consider a polynomial with integer coefficients and positive integer exponents P(x) = a0 * x0  + a1 * x1 + ... + an-1 * xn-1. Consider the problem of calculating the polynomial value for an integer value of its variable x. For example, if the polynomial is P(x) = 2 * x3 - 5 * x2 + 6 * x1 + 8 * x0 and the integer value is x = 2 than the value of P(2) is 16.

a)
Design and write the methods calculateBruteForce and calculateHorner for calculating the polynomial value by using the brute force approach and respectively Horner's technique. ForcalculateBruteForce method, define and invoke your own defined method for raising x to a given power, instead of calling a predefined method such as the Math.pow().
By analyzing the code, determine and indicate the complexity of the two methods in terms of Big-O notation. Which of the two methods would perform better in terms of execution time?

b)
Write a driver program TestPolyVal.java to validate the conclusions drawn from question a). Consider a polynomial with 20 terms whose coefficients are stored in an integer array and are randomly generated in the interval 1 .. 99. In the array of coefficients, the array cell of index i corresponds to the polynomial coefficient ai, while i represents the exponent of the variable x. Implement the following actions:
(b1) Invoke the two methods and display the polynomial value returned by the methods for a random generated integer value in the interval 1 .. 9.
(b2) Measure and display the execution time of the two methods as the arithmetic mean value of 100 executions. Use the method System.nanoTime() for determining the execution time. Discuss the obtained results. Are the results in line with your answer to question a?
Note. Due to the behavior of the JIT compiler, the execution time of the repeated programs is much slower the first times they are run and therefore make sure to discard the measured values for the initial 5 runs.

Question 2

Consider the text file Question2.txt
This file can be downloaded from the link provided below.

Design, write and test a java program TextProcessing.java doing the following tasks.

a)
Store all input file words (including the duplicated words) larger than 3 characters in an appropriate JCF data structure ds1. Give reason for your option. Display ds1 content.

b)
Remove all duplicated words from ds1 and store the remaining non-duplicated words in an appropriate, unsorted JCF data structure ds2. Word order in ds2 should be the same as in ds1. Give reason for your option. Display ds2 content. For example, if ds1 contains: alpha, theta, epsilon, theta, beta, gamma, theta, gamma then ds2 should contain:  alpha, theta, epsilon, beta, gamma.

c)
Sort ds2 words in lexicographical order and store the sorted words in an appropriate JCF data structure ds3. Give reason for your option. Display ds3 content.

Submission requirements

Submit the following before the due date listed in the Calendar:

1.TestPolyVal.java and TextProcessing.java source files.
2. A document file containing: (2.1) a short question(s) analysis, (2.2) design decisions and assumptions, (2.3) test cases and two relevant screenshots, (2.4) error handling, (2.5) lessons learned and (2.6) possible improvements. The size of the document file (including the screenshots) should be of two pages, single spaced, font size 12.

Submit the following before the due date listed in the Calendar:

1.TestPolyVal.java and TextProcessing.java source files.
2. A document file containing: (2.1) a short question(s) analysis, (2.2) design decisions and assumptions, (2.3) test cases and two relevant screenshots, (2.4) error handling, (2.5) lessons learned and (2.6) possible improvements. The size of the document file (including the screenshots) should be of two pages, single spaced, font size 12.

## Rubric Name: Assessment Rubric for Projects and Assignments

Attribute Does not Meet Meets 14 points (0-14 points) Rarely employs Modularity (including proper use of parameters, use of local variables etc.) Rarely employs correct & appropriate use of programming structures (loops, conditionals, classes etc.) Poorly structured and inefficient algorithms Rarely uses good object-oriented design 17 points (15-17 points) Employs Modularity (including proper use of parameters, use of local variables etc.) some of the time Employs correct & appropriate use of programming structures (loops, conditionals, classes etc.) some of the time Efficient algorithms used some of the time Good use of object-oriented design 20 points (18-20 points) Employs Modularity (including proper use of parameters, use of local variables etc.) most of the time Employs correct & appropriate use of programming structures (loops, conditionals, classes etc.) most of the time Efficient algorithms used most of the time Excellent use of object-oriented design 28 points (0-28 points) Program does not fulfill functionality Few requirements were fulfilled 35 points (29-35 points) Program fulfills most functionality Most requirements were fulfilled 40 points (36-40 points) Program fulfills all functionality All requirements were fulfilled Extra effort was apparent 14 points (0-14 points) No test plan included 17 points (15-17 points) Good test plan included 20 points (18-20 points) Comprehensive test plan 14 points (0-14 points) No comments No lessons learned No possible improvements No approach discussion 17 points (15-17 points) Good comments Some lessons learned Some possible improvements included Some approach discussion 20 points (18-20 points) Excellent comments Comprehensive lessons learned Excellent possible improvements included Excellent approach discussion and references

 Subject Computer Due By (Pacific Time) 09/05/2014 12:00 am
TutorRating
pallavi

Chat Now!

out of 1971 reviews
amosmm

Chat Now!

out of 766 reviews
PhyzKyd

Chat Now!

out of 1164 reviews
rajdeep77

Chat Now!

out of 721 reviews
sctys

Chat Now!

out of 1600 reviews
sharadgreen

Chat Now!

out of 770 reviews
topnotcher

Chat Now!

out of 766 reviews
XXXIAO

Chat Now!

out of 680 reviews
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy