Hi all!
Can you please help me to do homework 4 Java programs this is very important. I was in hospital and therefore missed many lessons, that's why i need your help because i can't do them alone.
1.
Make a class Box with int variables height, width, length. Box class must have a constructor Box (), which allows the height, width and length = 0, and another constructor Box (int h, int w, int l), which makes height = h, w = width and length = l. Add get and set methods for height, width and length. Additionally, create a method getSize () to return the volume (height * width * length).
Create a program that creates an object (box1) of the class Box (without calling the parameters so that the first constructor used) and an object (box2) of the class Box with height = 3 width = 4, length = 6 ( so that the second constructor used).
Put height = 2 width = 3, length = 11 on box1 using set-methods.
Print what box, which is highest and how much it is larger than the second box. (The program will decide which box, whichever is greater (or whether they are equal) using the method calls on box1 and box2.)
Put height = 3 on box1. Print what box, which is highest and how much it is larger than the second box.
Sets length = 8 on box1. Print what box, which is highest and how much it is larger than the second box.
2.
Make a class DiceGame with a private variable (diceArray) of type array of int. DiceGame must have a constructor, which instantiated diceArray with 5 seats, each seat will include a random number (int) between 1 and 6 Make a method rollDie (int index), which puts the figure at the space index in diceArray to a new random number between 1 and 6 Make a method getSum () which returns the sum of the 5 int in the array.
Make a method toString () which returns all figures in diceArray with space between as a String.
Create a program that creates an object (game) of the class DiceGame. Print the game through toString method, using getSum () to print the sum.
Call rollDie method with 1, 2 and 3 Print the game again and use getSum () to print the sum.
3.
Make a JApplet with a JTextField, a JTextArea and a JButton. Add code so that the text of JTextField added to JTextArea (append) and JTextField'et erased when you click on the button, so you are ready for the next text.
Create an HTML page that contains JApplet'en. (Remember to compile class, otherwise it can not run in the browser.)
4.
Make a JFrame with a JPanel and a JLabel. Add code so that each time you click the mouse on JPanel signed x and y coordinates of the mouse clicked in JLabel. (Note to Event Mouse has some methods you can use.)
Be sure to set up an object of your JFrame when the program is run. (If you have a main class, with an empty main method, nothing happens when I run the program.)
p.s. sorry for my bad english
