Advertisement
Guest User

Unit3 FinalProject

a guest
Mar 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. /*
  2. *This program will...
  3. *Andrew Menkes
  4. *DATE:
  5. */
  6.  
  7. import javax.swing.*;
  8. import java.text.*;
  9.  
  10. public class FinalProject
  11. {//open program
  12.  
  13.  
  14. public static void main(String[] args)
  15. {//open main method
  16. String[] aircraft= {"Blimp","Helicopter","Fighter Jet","Space Shuttle"};
  17. Object[] moveOptions= {1,2,3,4,5,6};
  18. int continueCharacteristics = 0;
  19. int numberOfMoves=0;
  20. boolean move1=false;
  21. boolean move2=false;
  22. boolean move3=false;
  23. boolean move4=false;
  24. boolean move5=false;
  25. boolean move6=false;
  26. boolean choseSameMove;
  27.  
  28. String aircraftChoice=(String)JOptionPane.showInputDialog(null,"Which aircraft will be simulated?","Final Project",JOptionPane.QUESTION_MESSAGE,null,aircraft,aircraft[0]);
  29. int moveChoice;
  30. do
  31. {
  32. do
  33. {
  34. choseSameMove=false;
  35. moveChoice=(int) JOptionPane.showInputDialog(null,"Which move are you choosing?\n\n"
  36. + "1. Position Trim (Trim)\n2. Force Breakout (Return-to-Center Force)\n3. Force Gradient (Spring Force)\n"
  37. + "4. Force Friction\n5. Damping\n6. Hard Stop","Final Project",JOptionPane.QUESTION_MESSAGE,null,moveOptions, moveOptions[0]);
  38. if(moveChoice==1 && !move1)
  39. {
  40. JOptionPane.showMessageDialog(null, "Position Trim (Trim) - The position to which a flight control returns when the pilot releases it.");
  41. move1=true;
  42. }
  43. else if(moveChoice==2 && !move2)
  44. {
  45. JOptionPane.showMessageDialog(null, "Force Breakout (Return-to-Center Force) - A force that returns a control to Trim. This is a constant\n"
  46. + " force applied toward Trim which remains the same despite how far the control is moved (displacement) and how fast a control is moved (velocity).");
  47. move2=true;
  48. }
  49. else if(moveChoice==3 && !move3)
  50. {
  51. JOptionPane.showMessageDialog(null, "Force Gradient (Spring Force) - A force that returns a control to Trim, but one that varies with\n"
  52. + " displacement. The farther the control is moved, the stronger the force applied toward Trim.");
  53. move3=true;
  54. }
  55. else if(moveChoice==4 && !move4)
  56. {
  57. JOptionPane.showMessageDialog(null, "Force Friction - A constant force that is opposite to the direction of movement.");
  58. move4=true;
  59. }
  60. else if(moveChoice==5 && !move5)
  61. {
  62. JOptionPane.showMessageDialog(null, "Damping - A force that is opposite to the direction of movement. Damping varies with velocity.\n"
  63. + "The faster a control is moved, the stronger the force.");
  64. move5=true;
  65. }
  66. else if(moveChoice==6 && !move6)
  67. {
  68. 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.");
  69. move6=true;
  70. }
  71. else
  72. {
  73. JOptionPane.showMessageDialog(null, "You already chose that move, please try again.");
  74. choseSameMove=true;
  75. }
  76. }
  77. while(choseSameMove);
  78. numberOfMoves++;
  79.  
  80. if(!move1 || !move2 || !move3 || !move4 || !move5 || !move5 || !move6)
  81. {
  82. continueCharacteristics = JOptionPane.showConfirmDialog(null, "Do you want to add another characteristic");
  83. }
  84. else
  85. {
  86. JOptionPane.showMessageDialog(null, "You adjusted all possible characteristics");
  87. continueCharacteristics=1;
  88. }
  89. }
  90. while(continueCharacteristics==0 || !move1 || !move2 || !move3 || !move4 || !move5 || !move5 || !move6);
  91.  
  92.  
  93.  
  94. JOptionPane.showMessageDialog(null, "You adjusted "+numberOfMoves+" characteristics for this flight on the "+aircraftChoice+".");
  95. }//close main method
  96.  
  97. }//close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement