2. 1.Create a Java program called GasCalculator that asks the user to input the size of a tank of gas (in gallons), the gas mileage of
a car (in miles per gallon), and the cost of gas (in rupees per gallon), and then displays how much it would cost to fill the tank
and how many miles the car can be driven on a full tank. Make sure that the program explains clearly what each input should
be when it asks for them and also explains what the outputs represent when they are printed to the screen.
2.Design and implement an application Password.java that produces and prints a random password. The password is composed
of random digits 0-9 and characters a-z. The first element is a character, the second is a digit, then a character, a digit, a
character, a digit, a character, and a digit (8 elements in total). An example is: e5c8a0b6.
3.Design and implement an application called MonsterGame.java that simulates a simple game. You have three magic arrows
to kill an evil monster. When you fire an arrow, the program generates a random integer between 0 and 10 (including 0 and 10).
This number shows how much damage you did to the monster. The monster has 10 energy points initially. After each arrow is
fired (by simply printing a message that says it was fired and shows the random number), the monster’s energy is decreased by
the generated number (but not decreased below zero). After you fire the first arrow, if the monster’s energy is zero, print the
message “You won!!!”; otherwise you fire the second arrow. After you fire the second arrow, if the monster’s energy is zero,
you win; otherwise you fire the third arrow. If in the end the energy is zero, you win; otherwise, print the message: “Nice try.
Almost there!”. After each arrow is fired, print a message with the current energy level left for the monster. After the game is
over, print the message “Do you want to play again? (y/n)”, and allow the user to play as many times as desired.