Question: Java Programming Question. Part A is completed, and I understand how to write a menu program, but for Part B, how do I input a

Java Programming Question.

Java Programming Question. Part A is completed, and I understand how to

write a menu program, but for Part B, how do I input

a second polynomial? Code for part A is below. import java.util.Scanner; public

Part A is completed, and I understand how to write a menu program, but for Part B, how do I input a second polynomial? Code for part A is below.

import java.util.Scanner; public class PartA { public static void main (String [] args) { int deg,coeff; double xval, seg, sum = 0.0; Scanner sc = new Scanner (System.in); System.out.println("Enter the degree of the polynomial"); //Degree input deg = sc.nextInt(); System.out.println("Enter the value of x to evaluate the polynomial at"); //x value input xval = sc.nextInt(); for (int i = 0; i a) Polynomials are equations like the following: 24 35+21x + 9x + 7x + 10x which has one variable (x) and is a summation of many (we'll call) segments. Each segment includes a coefficient and an exponent. For every polynomial, the degree is defined as the highest exponent of any segiment. So for the above polynomial, the degree is 5. Note that for each exponent from 0 to degree (in this case 5), there is a segment, even though there is no segment that appears in the polynomial with an exponent of 3, there really is (we just say it has a coefficient of O, since 0 times anything is 0). In addition, for each exponent i (where i is from 0 to the degree), there is at most one segment with such an exponent (if there were multiple, we could simply combine them). Frequently, we like to evaluate polynomials at specific values ofx. That is, given the polynomial above, we'd like to know what the polynomial equals when, say, x=3. In the above example, the polynomial equals 3176 when x-3, since 35 +21(3) + 9(9) + 0(27) +7(81) + 10(243) = 3176 a) Polynomials are equations like the following: 24 35+21x + 9x + 7x + 10x which has one variable (x) and is a summation of many (we'll call) segments. Each segment includes a coefficient and an exponent. For every polynomial, the degree is defined as the highest exponent of any segiment. So for the above polynomial, the degree is 5. Note that for each exponent from 0 to degree (in this case 5), there is a segment, even though there is no segment that appears in the polynomial with an exponent of 3, there really is (we just say it has a coefficient of O, since 0 times anything is 0). In addition, for each exponent i (where i is from 0 to the degree), there is at most one segment with such an exponent (if there were multiple, we could simply combine them). Frequently, we like to evaluate polynomials at specific values ofx. That is, given the polynomial above, we'd like to know what the polynomial equals when, say, x=3. In the above example, the polynomial equals 3176 when x-3, since 35 +21(3) + 9(9) + 0(27) +7(81) + 10(243) = 3176

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!