Thursday, September 15, 2011

Code Review Test 1

public class PerimeterSquare
{
	public static void main(String[] args)
	{
		//  declare a double variable called side and assign it an initial value of 5

                    double side = 5;


		//  declare a double variable called perimeter

                   double perimeter;
// write an assignment statement in which you calculate and assign the perimeter to // perimeter
                   perimeter = 4 * side;
// write a statement which outputs the perimeter
                   System.out.println("perimeter = " + perimeter);
} } public class SecondsMinutes { public static void main(String[] args) { // declare a constant called SECONDSINAMINUTE and assign it a value of 60
                   final int SECONDSINAMINUTE = 60;
// declare an int variable called seconds and assign it an initial value of 67
                   int seconds = 67;
// declare an int variable called minutes
                   int minutes;
// write an assignment statement in which you calculate the number of minutes and // assign it to minutes
                   minutes = seconds / SECONDSINAMINUTE;
// write a statement which you calculate the number of remaining seconds and assign it to // seconds seconds = seconds % SECONDSINAMINUTE;
		
		// output minutes

                   System.out.println("minutes = " + minutes);
// output seconds
                   System.out.println("seconds = " + seconds);
} }