I'm having Java course and I have to submit the following programs by the coming Wednesday for what I am not skilled enough till now. Please may you code those for me for this time?

PART 1

P1. Write a java program to calculate the roots of a quadratic equation f(x) = ax^2 + bx + c.
Take the equation coefficient input a, b, and c from the keyboard. Check for normal, equal and imaginary roots.

Sample Output

             Two roots are equal and x = 5
       The complex roots are, x1 = 1 + 2i and x2 = 1 - 2i
Roots are, x1 = 3.2 and x2 = - 1.5

P2. Write a program that takes two integers x, y as input and prints the sum result in the screen.

       Version 1: (task-based program)
                  Use code for console input and  output
       Version 2: (GUI program)
                  Use code for GUI input and output (JOptionPane)

P3. Write a program that takes three integers s, y, z as input and prints the maximum and minimum numbers in the screen. Use only grapical I/O.

PART 2

P4. Write a java program to design the following method that can ve used to find the sum of surrounding row and columns in a two dimensional square array of size n*n.

         /*
            Input: A two difmensional square array of integers.
          Output: Returns the sum of surrounding rows and columns.
         */
          int surroundingSum ( int [][] array){
          }

P5. Write a program to allocate differing sized 2nd dimensions of a two-dimensional array and assign the following pattern. Allocation code should follow the pattern; no manual allocation will be allowed.

                55    45   36
                28    21
                15
                10     6
                  3     1      0

P6. Generate the following diamond pattern (using 'loop' operation)

                              1
                         4   2   4
                    9   6   3   6   9
                         4   2   4
                              1

Recommended Answers

All 4 Replies

I'm having Java course and I have to submit the following programs by the coming Wednesday

Was the assignment given to you today? If no, then what were you doing all this time? If yes, then you have a very demanding teacher.

Please may you code those for me for this time?

Does this mean that next time you will do it on your own?
But if you can't do this now, how will you be able to do the more advanced? Not to mention that you would not have learned how to think on your own, so even if you do understand the code that we would have given you, you would not be able to think the solution for the next assignment.

He gave those today.

Whatever, I usually solve problems by myself, I know how to work hard, but some times people need help and now its my turn.

Dont think that I'm doing nothing, I've arrived home and going to study books for necessary clues, then I'll try. But if I'd fail then its a big problem because I have to submit it day after tomorrow. Thats why I'm asking for help.

Ok, I can prove that I'm trying. If you code the programs in some way I may chance few or enough codes but output will be similar to prove that I can understand all your code.

Well I cannot do the whole thing for you, nor offer help without knowing your level.
And to see your level I will need to see some code.

For the Part 1 you will need the Math class. (search it at the net)
and the
JOptionPane class. Use the static methods (showInputDialog).
For component use null.

Don't bother with the input. First use variables with initial values to do correctly the calculations and then search this forum for the Scanner class and how to read input using that.

Ya, teacher said we need those things that you've mentioned.

I think I can come to a solution with part 1 by tomorrow morning arround 11 am( its 9.40 pm now). Then I'll try for part 2, and shall ask for helps if I need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.