/* * ============================================================= * WindForce.java: Compute and print force due to gusts of wind. * * Written By: Mark Austin November 2005 * ============================================================= */ import java.lang.Math; import java.text.*; public class WindForce { // main method : this is where the program execution begins. public static void main ( String [] args ) { double dT, dTime; // Print windforce heading System.out.println(" Time Force"); System.out.println("(seconds) (kN)"); System.out.println("===================="); // Compute and print wind force for ( dTime = 0.0; dTime <= 3.0; dTime = dTime + 0.25 ) { System.out.printf(" %6.2f %7.2f\n", dTime, windForce ( dTime - Math.floor( dTime ) ) ); } } // Method that computes the wind force. static double windForce( double dT ) { double dWindForce; if (dT <= 0.3 ) dWindForce = (4.0 + 15.0*dT - 135.0*Math.pow(dT, 3.0)); else dWindForce = ((731.0 - 171*dT)/140.0); return dWindForce; } }