Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1.  
  2. //Let's get started
  3. package FCITbaqalah;
  4. //CPCS 204 Program assignment.. by Abdulaziz Alsuraya - 1407165
  5.  
  6.  
  7. import java.io.File;
  8. import java.io.FileNotFoundException;
  9. import java.io.PrintWriter;
  10. import java.util.Scanner;
  11.  
  12.  
  13.  
  14. public class FCITbaqalah {
  15.  
  16. private static Object command;
  17.  
  18.  
  19. public static void main(String[] args) throws FileNotFoundException {
  20. // i/o File..
  21. // Input..
  22. File inputFile = new File("FCITBAQALA.in") ;
  23. if (!inputFile.exists());
  24. System.out.println("The Input File"+inputFile+"doesn't exist");
  25.  
  26. //Output..
  27. File outputFile = new File("FCITBAQALA.out") ;
  28.  
  29. PrintWriter output;
  30. try ( //Scanner..
  31. Scanner input = new Scanner(inputFile)) {
  32. output = new PrintWriter(outputFile);
  33. //For the arrays..
  34. int MaxProducts=input.nextInt();
  35. int MaxSales=input.nextInt();
  36. FCITbaqalahProduct[] products = new FCITbaqalahProduct[MaxProducts];
  37. FCITbaqalahSales[] sales = new FCITbaqalahSales[MaxSales];
  38. //Commands
  39. do {
  40. String command = input.next();
  41.  
  42. // COMMAND1..
  43. if (command.equals("COMMAND1") == true) {
  44. /*int ItemNum=input.nextInt();
  45. String ItemName=input.next();
  46. double ItemPrice=input.nextDouble();
  47. int RestockQuantity=input.nextInt();
  48. int quantity=input.nextInt();
  49. System.out.println("ItemNum");
  50. System.out.println("ItemName");
  51. System.out.println("ItemPrice");
  52. System.out.println("RestockQuantity");
  53. System.out.println("quantity");*/
  54.  
  55.  
  56. }
  57.  
  58. // COMMAND2..
  59. else if (command.equals("COMMAND2") == true) {
  60.  
  61.  
  62.  
  63. }
  64.  
  65. // COMMAND3..
  66. else if (command.equals("COMMAND3") == true) {
  67.  
  68.  
  69. }
  70.  
  71. // Command QUIT..
  72. else if (command.equals("QUIT") == true) {
  73. output.println("Hope this example helps understanding and processing commands from input.");
  74. output.println("Goodbye.");
  75. }
  76.  
  77. // Invalid Command
  78. else {
  79. System.out.println("Invalid Command: input invalid.");
  80. }
  81. } while (command.equals("QUIT") != true);
  82. // Close input and output
  83. }
  84. output.close();
  85. }
  86.  
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement