Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: Java  |  size: 0.71 KB  |  hits: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import edu.uci.ics.pattis.introlib.Prompt;
  2.  
  3.  
  4. public class Rocket {
  5.  
  6.        
  7.         public static void main(String[] args) {
  8.                 //Variables
  9.                 int thrust;
  10.                 double duration;
  11.                 int mass;
  12.                
  13.                 double time = 0;
  14.                
  15.                 //Input
  16.                
  17.        
  18.                 //Calculate
  19.                
  20.                 for(;;){
  21.                        
  22.                         thrust = Prompt.forInt("Enter Thrust<in pounds>");
  23.                         duration = Prompt.forDouble("Enter Duration<in seconds>");
  24.                         mass = Prompt.forInt("Enter Mass<in pounds>");
  25.                         if (duration>time)
  26.                         {time=(double) (time+.01);   //need to get the time increment of .01 sec
  27.                        
  28.                         }
  29.                        
  30.                         if (duration<time)
  31.                         {break;
  32.                         }
  33.                        
  34.                        
  35.                        
  36.                         System.out.println("thrust" + thrust);
  37.                         System.out.println("time" + time);
  38.                        
  39.                        
  40.                
  41.                         }
  42.                                
  43.                 }
  44.                
  45.                
  46.        
  47. }