Question: please help, I need it now, I will rate, Use Notepad on your lab computer for your input. Your file name will be Final YourName.
please help,
I need it now,
I will rate,
Use Notepad on your lab computer for your input. Your file name will be FinalYourName.txt. Make sure your name is in program text
Once you have completed your .txt file, upload it to canvas just as you have for other assignments except the file type will be .txt NOT .java. Do not bring up or use Eclipse.
You will create only one class , which will contain
A)You will code 2 methods each of which has a specific task.
The main routine < public static void main(String[] args) >
will call these two methods to perform the task (see B).
B) Your program will determine if a randomly generated (int) x,y, is within the intersection of two overlapping rectangles (or on the border of this intersection) where both rectangles are within a predefined search space. The predefined search space has coordinates (0,0),(0,30), (30,30), (30,0). So make sure your x,y do not fall outside this area. The two intersecting rectangles have individual opposite corner coordinates that are defined by the (int) variables; rectangle 1: r1x1,r1y1 & r1x2, r1y2 and
rectangle 2: r2x1,r2y1 & r2x2, r2y2
The two separate methods will:
1) Method 1: Generate the appropriate random values for x,y to be used in the search , use Math.random();
2) Method 2: Determines if x,y are both within the intersection (or on the border of the intersection) of the two intersecting rectangles whose individual opposite corner (int) coordinates are:
rectangle 1: r1x1,r1y1 and r1x2, r1y2 and rectangle 2: r2x1,r2y1 and r2x2, r2y2
Note: Use these variable names in your program!!!
C) The
1) It will output to console each x,y, it tries for a hit inside the intersection of the two rectangles
2) It will also have the logic to output to the console the x,y coordinates (only once) when x,y are within the intersection (a hit) and then exit the program.
Use: System.out.printlnl(A hit at , x + , +y);
3) There is no user input and all output is to the console.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
