All pastes #2122595 Raw Edit

Stuff

public text v1 · immutable
#2122595 ·published 2012-02-29 02:21 UTC
rendered paste body
/*Luke Nikolau
 * CS 251
 * Program 5
 */

import java.util.*;

public class WoodenDriver 
{
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String repeatPrompt;

		System.out.println("Welcome to the Wooden Column Program!");
		System.out.println("************************************\n");

		do
		{
			System.out.println("Enter parameters for a wooden column");
			System.out.println("Enter column height (feet):");
			double height = sc.nextDouble() * 12;
			System.out.println("Enter column width (inches):");
			double width = sc.nextDouble();
			System.out.println("Enter column expected load (psi):");
			double expectedLoad = sc.nextDouble();

			WoodenColumn column = new WoodenColumn(height, width, expectedLoad);
			column.count++;
			String columnString = column.toString();
			System.out.println("Your wooden column is: " + columnString);
			
			boolean isSafe = column.isSafe();
			boolean slender = column.isTooSlender();
			boolean buckle = column.willBuckle();
			boolean compress = column.willCompress();
			
			if(isSafe) {
				System.out.println("The column is safe.");
			} else {
				System.out.println("The column is unsafe.");
				WoodenColumn newColumn = new WoodenColumn();
				WoodenColumn.minStandardColumn(height, expectedLoad);
				System.out.println("This standard column would be better: " + WoodenColumn.minStandardColumn(height, expectedLoad));
			}
			
			if(slender)
				System.out.println("Your column is too slender!");			
			if(buckle)
				System.out.println("Your column will buckle!");			
			if(compress)
				System.out.println("Your column will compress!");
			
			System.out.println("Would you like to make another column? (y/n) : ");
			repeatPrompt = sc.next();
		} while(repeatPrompt.equalsIgnoreCase("y"));
		System.out.println("Total number of wooden column objects created: " );
		
	}

}