Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *This program will...
- *Andrew Menkes
- *DATE:
- */
- import javax.swing.*;
- import java.text.*;
- public class FinalProject
- {//open program
- public static void main(String[] args)
- {//open main method
- String[] aircraft= {"Blimp","Helicopter","Fighter Jet","Space Shuttle"};
- Object[] moveOptions= {1,2,3,4,5,6};
- int continueCharacteristics = 0;
- int numberOfMoves=0;
- boolean move1=false;
- boolean move2=false;
- boolean move3=false;
- boolean move4=false;
- boolean move5=false;
- boolean move6=false;
- boolean choseSameMove;
- String aircraftChoice=(String)JOptionPane.showInputDialog(null,"Which aircraft will be simulated?","Final Project",JOptionPane.QUESTION_MESSAGE,null,aircraft,aircraft[0]);
- int moveChoice;
- do
- {
- do
- {
- choseSameMove=false;
- moveChoice=(int) JOptionPane.showInputDialog(null,"Which move are you choosing?\n\n"
- + "1. Position Trim (Trim)\n2. Force Breakout (Return-to-Center Force)\n3. Force Gradient (Spring Force)\n"
- + "4. Force Friction\n5. Damping\n6. Hard Stop","Final Project",JOptionPane.QUESTION_MESSAGE,null,moveOptions, moveOptions[0]);
- if(moveChoice==1 && !move1)
- {
- JOptionPane.showMessageDialog(null, "Position Trim (Trim) - The position to which a flight control returns when the pilot releases it.");
- move1=true;
- }
- else if(moveChoice==2 && !move2)
- {
- JOptionPane.showMessageDialog(null, "Force Breakout (Return-to-Center Force) - A force that returns a control to Trim. This is a constant\n"
- + " force applied toward Trim which remains the same despite how far the control is moved (displacement) and how fast a control is moved (velocity).");
- move2=true;
- }
- else if(moveChoice==3 && !move3)
- {
- JOptionPane.showMessageDialog(null, "Force Gradient (Spring Force) - A force that returns a control to Trim, but one that varies with\n"
- + " displacement. The farther the control is moved, the stronger the force applied toward Trim.");
- move3=true;
- }
- else if(moveChoice==4 && !move4)
- {
- JOptionPane.showMessageDialog(null, "Force Friction - A constant force that is opposite to the direction of movement.");
- move4=true;
- }
- else if(moveChoice==5 && !move5)
- {
- JOptionPane.showMessageDialog(null, "Damping - A force that is opposite to the direction of movement. Damping varies with velocity.\n"
- + "The faster a control is moved, the stronger the force.");
- move5=true;
- }
- else if(moveChoice==6 && !move6)
- {
- JOptionPane.showMessageDialog(null, "Hard Stop - A force that simulates a mechanical limit of travel. By varying the Hard Stops, the range of travel can be adjusted.");
- move6=true;
- }
- else
- {
- JOptionPane.showMessageDialog(null, "You already chose that move, please try again.");
- choseSameMove=true;
- }
- }
- while(choseSameMove);
- numberOfMoves++;
- if(!move1 || !move2 || !move3 || !move4 || !move5 || !move5 || !move6)
- {
- continueCharacteristics = JOptionPane.showConfirmDialog(null, "Do you want to add another characteristic");
- }
- else
- {
- JOptionPane.showMessageDialog(null, "You adjusted all possible characteristics");
- continueCharacteristics=1;
- }
- }
- while(continueCharacteristics==0 || !move1 || !move2 || !move3 || !move4 || !move5 || !move5 || !move6);
- JOptionPane.showMessageDialog(null, "You adjusted "+numberOfMoves+" characteristics for this flight on the "+aircraftChoice+".");
- }//close main method
- }//close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement