Guest User

Untitled

a guest
May 26th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. //
  2. // Lease Applicaiton Main
  3. //
  4. // This class contains the main which initilises the user interface. The majority
  5. // of the work is done in the LeaseContents class.
  6. //
  7. // Author: <Tom Wyatt>
  8. //
  9. //
  10. //
  11.  
  12. import javax.swing.*; // Required for GUI
  13. import javax.swing.JOptionPane;
  14. import java.util.Scanner;
  15.  
  16. public class LeaseApp
  17. {
  18. public static void main(String []args)
  19. {
  20. System.out.println("Interdum Laptops - Lease Application\n");
  21.  
  22. LeaseContents reviewc = new LeaseContents();
  23.  
  24.  
  25.  
  26. {
  27. String inputEmail = JOptionPane.showInputDialog(null, "Please enter a valid email address"); // This code is for the users input email box.
  28. Scanner emailScanner = new Scanner(inputEmail);
  29. String email = emailScanner;
  30. }
  31. {
  32. String inputRef = JOptionPane.showInputDialog(null, "Please enter your Reference Number"); //This code is for the users
  33. Scanner refScanner = new Scanner(inputRef); //reference number input.
  34. String reference = refScanner;
  35. }
  36. {
  37. String [] model = {"bronze", "silver", "gold"}; // used to display the option dialog for the user to pick
  38. int choice = JOptionPane.showOptionDialog(null, // which type of model they would like to have.
  39. "Select the model you wish to have",
  40. "Model choice",
  41. JOptionPane.OK_OPTION,
  42. JOptionPane.QUESTION_MESSAGE,
  43. null,
  44. model,
  45. model[0]);
  46. System.out.println("You chose the model type: " + model[choice]);
  47. }
  48. {
  49. String [] lease = {"12", "18", "24", "36"}; // used to display the option dialog for the user to pick
  50. int choice = JOptionPane.showOptionDialog(null, // the amount of time they can lend the system for.
  51. "Select the lease period, in months, which you would like to have",
  52. "Lease period choice",
  53. JOptionPane.OK_OPTION,
  54. JOptionPane.QUESTION_MESSAGE,
  55. null,
  56. lease,
  57. lease[0]);
  58. System.out.println("You chose the lease period of: " + lease[choice] "months");
  59. }
  60.  
  61.  
  62. {
  63. String [] additionalOpt = {"Add RAM", "Remove RAM", "Warranty", "Mouse", "Keyboard", "Monitor", "1TB HDD", "250GB SDD", "Office Software", "Finish"};
  64. int choice = JOptionPane.showOptionDialog(null,
  65. "Select Additional Options" +inserthere+ "GB Additional RAM and" +insertheretoo+ "options selected)", // used to display the additional options dialog
  66. "Additional Options choice", // where users can select anything additional.
  67. JOptionPane.OK_OPTION,
  68. JOptionPane.QUESTION_MESSAGE, // it will show the number of toggled selections,
  69. null, // aswell as the amount of RAM (to a max of 8GB)
  70. additionalOpt,
  71. additionalOpt[0]);
  72. System.out.println("You chose the lease period of: " + additionalOpt[choice] "months");
  73. }
  74.  
  75. }
  76. }
Add Comment
Please, Sign In to add comment