RMIT Classification: Trusted Introduction to Java Exercise 1 Implement a Java program to output your name in a frame. Replace "Tri Dang" with your name. ************ * Tri Dang * ************ Exercise 2 Implement the code to exchange the values of 2 variables x and y. Assume that int x = 10; int y = 20; How can you assign the value of x to y and vice versa? Your code must work correctly for all possible values of x and y (not just 10 and 20 as in the example above). Exercise 3 The number of seconds from mid-night to now is S. Display the current time as "h:m:s" Examples: If S = 0, display "0:0:0" If S = 1, display "0:0:1" If S = 60, display "0:1:0" If S = 3600, display "1:0:0" If S = 3661, display "1:1:1" S is given by users from the keyboard (hint: use java.util.Scanner class) Exercise 4 There are 2 points A, B on a plane. The x and y coordinates of each point are entered by users. Calculate the circumference and area of the square whose one side is the line segment AB. Example 1 Ax = 0, Ay = 0 Bx = 2, By = 0 Then, circumference = 8 and area = 4 Example 2 Ax = 0, Ay = 0 Bx = 1, By = 1 Then, circumference = 5.657 and area = 2 RMIT Classification: Trusted Exercise 5 There are 2 circles. The x, y coordinates of the circles' centers as well as the circles' radiuses are entered by users. Determine if 2 circles intersect. Exercise 6 Insert the following code as the first line in your Java program. package rmit; Compile and execute your program. Are there any errors? How can you fix them? Exercise 7 Can you name your Java file differently from the class name? How about removing the modifier public from the class definition? Try those suggestions and see what you get.