Add two polynomials
Given two polynomials A and B, write a program that adds the given two polynomials A and B.
Sample Input
4
0 5
1 0
2 10
3 6
3
0 1
1 2
2 4
Sample Output
6x^3 + 14x^2 + 2x + 6
Sample input
4
0 5
1 0
2 10
3 6
4
0 -5
1 0
2 -10
3 -6
Sample Output
Should be Zero: 0
Sample Input
5
0 2
1 0
2 1
4 7
3 6
5
2 4
3 3
4 5
0 1
1 0
Sample Output
12x^4 + 9x^3 + 5x^2 + 3
Add two polynomials
Given two polynomials A and B, write a program that adds the given two polynomials A and B.
Sample Input
4
0 5
1 0
2 10
3 6
3
0 1
1 2
2 4
Sample Output
6x^3 + 14x^2 + 2x + 6
Sample input
4
0 5
1 0
2 10
3 6
4
0 -5
1 0
2 -10
3 -6
Sample Output
Sample Input
5
0 2
1 0
2 1
4 7
3 6
5
2 4
3 3
4 5
0 1
1 0
Sample Output
12x^4 + 9x^3 + 5x^2 + 3
Suppose you have an empty generic stack. Indicate which of the following instructions will invoke a stack underflow.
1. Push 1
2. Push 2
3. Pop
4. Push 9
5. Pop
6. Pop
7. Pop
8. Pop
9. Push 3
1Suppose you have an empty generic stack. What does the stack look like after the following operations have been performed? Be sure to indicate the top of the stack.
Push 4
Push 9
Push 1
Push 9
Pop
Push 8
Pop
Pop
Push 3
Write a program using one-dimensional array that searches a number if it is found on the list of the given 5 input numbers and locate its exact location in the list.
Sample input/output dialogue:
Enter a list of numbers: 5 4 8 2 6
Enter a number to be searched: 2 2 found in location 4
Add two polynomials
Given two polynomials A and B, write a program that adds the given two polynomials A and B.
Sample Input
4
0 5
1 0
2 10
3 6
3
0 1
1 2
2 4
Sample Output
6x^3 + 14x^2 + 2x + 6
Sample input
4
0 5
1 0
2 10
3 6
4
0 -5
1 0
2 -10
3 -6
Sample Output
Sample Input
5
0 2
1 0
2 1
4 7
3 6
5
2 4
3 3
4 5
0 1
1 0
Sample Output
12x^4 + 9x^3 + 5x^2 + 3
how it is possible two outputs(sample output 1, sample output 2) in this program
Using arrays data structure, write a C program that gives the number with high occurrences
Create a Java ArrayList of String type “fromCity”, use “Add()” method to add three elements: “Los Angeles”, “San Francisco”, and “Portland”. Create another Java ArrayList of String type “toCity” with three elements: “Seattle”, “Denver”, and “Chicago”. Make two-dimensional array of int type named “distance” whose elements are from table. Be sure to make the elements using the index of [from][to].
4x4 Table:
fromCity \ toCity | 0 | 1 | 2 | 3
0 |1135 | 1016 | 2015
1 | 807 | 1250 | 2128
2 | 174 | 1240 | 2121
Ask user to enter name of city to “travel from”, use “indexof()” method to find the index of the given city in the “fromCity” ArrayList.
Ask user to enter the name of city to “travel to”, then use“indexOf()” method to find the index of the given city in the “toCity” ArrayList. Find “distance” array and display it.
The program must prompt the user for the price of a phone. Compute the sales tax for this value, and then display the phone price, the dollar amount of the sales tax, and the total charge for this purchase. Sales tax is calculated as 7% of the price of the phone. Total charge is the price plus the sales tax amount.
After all the data has been entered, display a grand total of number of phones sold, and a grand total of all total charges.
This program must use at least two subroutines.
*Program must be typed in BASIC