Question: Write an error-free Java program to do the following things. Prompts the user to input two data values. The data values should be doubles and
Write an error-free Java program to do the following things. Prompts the user to input two data values. The data values should be doubles and correspond to the magnitude and component of a 2D vector (r, x). Assume r and x are zero or positive numbers. From the main module (method), call a method that calculates the y component of the vector. The method should be called yvalue (or something similar). It should have two input parameters (the aforementioned r and x) and return a double value that is the y component of the vector You can find y using the Pythagorean formula or using basic trig functions. . The main function should also call a second method that calculates the value of the vector From the main method, display the values of y and 6. Display in degrees. Use a loop in main to do all of the above twice. That is, the program should read in a second set of r, x values and calculate y and for the new values. The main function should print a message saying something like this: . input r and x components of vector .DThe y and theta values of a vector with -C r = 5.0 and x = 4.0 are y3.00 and theta 36.87 degrees .1 Input r and x components of vector 07 . The y and theta values of a vector with r = 7.07 and x 5.0 are y-5.00 and theta 44.99 degrees
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
