Util Class Assignment - Static Classes
1) Using the Util class make a table of Perfect Squares from 1-10 as you will see below
Perfect Squares Table
Number Number Squared
======= ==============
1 1
2 4
3 9
4 16
5 25
2) Add the following two pause methods to the Util class. The pause with the signature (int) will be able to vary the amount of pause depending on what the value sent in to the method is. Use the pause methods to show the squareroot table being formed number by number.
public static void pause()
{
for(int x=0;x<2000000000;x++);
}
public static void pause(int n)
{
for(double x=0;x<100*n;x+=.001);
}
3) Using the asterisk key or any other favorite key and as many of the Util methods as you can make a nice bit of artwork. This should be a void method of the Util class called drawArt().
4) Add a method called getKey() to the Util class. This method will say "press a key to continue" and will have one input.nextLine() in it. You will need to put an import java.util.Scanner at the top of the Util class and you will need to make a Scanner object input INSIDE the getKey() method.
5) Add another method to the Util class of your design and demonstrate in the UtilProg code.
Grading
85 - 1-4 on the assignment - Use pause() and pause(n) in the other methods.
90- one extra method
95- two extra methods
100 - extra method with parameters