Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a java program that draws a shape. has a method to draw it and a method to make it dance(move).
Write a void method Shift that takes three parameters A, p, d.
A is an array, p is the number of positions and d is the direction (L = left, R = right). The method should shift the contents of A p positions in the d direction.
(B) To test your method, write a program that reads an array of 10 elements then calls Shift twice and prints the array after each call.
Example:
Enter 10 elements of array A:
17 11 12 15 18 19 20 23 28 39
Enter Shift direct L
Enter number of positions 3
Array After Shift 15 18 19 20 23 28 39 0 0 0
Enter Shift direct R
Enter number of positions 2
Array After Shift 0 0 15 18 19 20 23 28 39 0
====================================================
Bonus: Change the program to do Array rotation rather than shifting.
For Example:
Enter 10 elements of array A:
17 11 12 15 18 19 20 23 28 39
Enter Rotate direct L
Enter number of positions 3
Array After Rotation 15 18 19 20 23 28 39 17 11 12
Enter Rotate direct R
Enter number of positions 2
Array After Rotation 11 12 15 18
Write a Java program to add and multiply two polynomials. The rules are as follows:
1. Ask the user to enter two polynomials at a time. For each polynomial, ask the user to enter the number of terms n in the polynomial, then prompt the user n times for a pair of integers representing the coefficient and the exponent of a term. For instance, the term 2x4 has a coefficient of 2 and an exponent of 4.
2. Output the input polynomials as well as the sum and product of polynomials.
A sample input/output run is as follows.
For p1, enter # XXXXX polynomial terms (n>=0): 2
Enter coefficient: 1
Enter exponent: 1
Enter coefficient: 1
Enter exponent: 0
You entered: x + 1
For p2, enter # XXXXX polynomial terms (n>=0): 2
Enter coefficient: 1
Enter exponent: 1
Enter coefficient: -1
Enter exponent: 0
You entered: x - 1
p1 = x + 1
p2 = x - 1
p1+p2 = 2x
p1*p2 = x^2 – 1
3. The output polynomials must be sorted in descending order of exponent. Terms of the same exponent should be added together and the term
(ArrOp Class) Create a class called ArrOp which doesn’t have any instance variables. Your class should have the following methods
a. public int[ ] linearize(int[ ][ ] A) that takes a two-dimensional array as a parameter and returns a one-dimensional array with all the elements of the two-dimensional array.
For example, given the following array:
30 20 10
50 90 60
70 80 40
The method will return a 1-dimensional array with the following elements:
30 20 10 50 90 60 70 80 40
b. public void SortArray(int[ ] A) that takes a one-dimensional array and sort its elements in descending order. For example, given the following array:
30 20 10 50 90 60 70 80 40
The method will sort the array elements to be as following:
90 80 70 60 50 40 30 20 10
c. public void Rotate(int [ ] A) that takes a one-dimensional array and rotate the contents of A one step the right using system method System.arraycopy
For example, given the following array:
90 80 70 60 50 40 30 20 10
The method will rotate the array elements one
Write a java program that draws a shape. has a method to draw it and a method to make it dance(move). program must have a contructor.
I have to write a program in java to generate Parkside's Triangle, with size and seed numbers 1-9. I wrote a method to get the size and seed using a drop down box, but I'm having trouble coming up with code to generate the actual triangle in a second method and calling it into my main method.
I am confused on how to create a program that aligns a block of text to the left, center, or right.
The description of my assignment is listed here. We only briefly only started on arrays, but then this assignment feels like it is beyond what I know.
Assignment is located at:
http://classes.soe.ucsc.edu/cmps012a/Fall12/prog/pgm3.html
write a program to grade students' marks and it must accept all inputs in java

write a program to calculate the volume of a cylinder given V=pi*r*r*h pi=3.14. and it should accept all inputs
One application of switch statements is in processing menus. A menu is a list of options. The user selects one of the options. The computer has to respond to each possible choice in a different way. If the options are numbered 1, 2, ..., then the number of the chosen option can be used in a switch statement to select the proper response. Write a Java program that asks the user to enter the measurement in inches and the type of conversion 1. Inches 2. Feets 3. Yards 4. Mies The program should use switch statement and TextIO library to write text on the screen and prints the converted measurement. In a TextIO-based program, the menu can be presented as a numbered list of options, and the user can choose an option by typing in its number.
Probability: Rolling 6 sided dice can teach us about probability.
Allow the user to choose a number of rolls for 2 six sided dice. Use random number generator to produce the resulting rolls.

Add the dice together and keep track of how many of each of the sums are rolled. Print out a frequency distribution table and then a frequency histogram
LATEST TUTORIALS
APPROVED BY CLIENTS