Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Let's get started
- package FCITbaqalah;
- //CPCS 204 Program assignment.. by Abdulaziz Alsuraya - 1407165
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.PrintWriter;
- import java.util.Scanner;
- public class FCITbaqalah {
- private static Object command;
- public static void main(String[] args) throws FileNotFoundException {
- // i/o File..
- // Input..
- File inputFile = new File("FCITBAQALA.in") ;
- if (!inputFile.exists());
- System.out.println("The Input File"+inputFile+"doesn't exist");
- //Output..
- File outputFile = new File("FCITBAQALA.out") ;
- PrintWriter output;
- try ( //Scanner..
- Scanner input = new Scanner(inputFile)) {
- output = new PrintWriter(outputFile);
- //For the arrays..
- int MaxProducts=input.nextInt();
- int MaxSales=input.nextInt();
- FCITbaqalahProduct[] products = new FCITbaqalahProduct[MaxProducts];
- FCITbaqalahSales[] sales = new FCITbaqalahSales[MaxSales];
- //Commands
- do {
- String command = input.next();
- // COMMAND1..
- if (command.equals("COMMAND1") == true) {
- /*int ItemNum=input.nextInt();
- String ItemName=input.next();
- double ItemPrice=input.nextDouble();
- int RestockQuantity=input.nextInt();
- int quantity=input.nextInt();
- System.out.println("ItemNum");
- System.out.println("ItemName");
- System.out.println("ItemPrice");
- System.out.println("RestockQuantity");
- System.out.println("quantity");*/
- }
- // COMMAND2..
- else if (command.equals("COMMAND2") == true) {
- }
- // COMMAND3..
- else if (command.equals("COMMAND3") == true) {
- }
- // Command QUIT..
- else if (command.equals("QUIT") == true) {
- output.println("Hope this example helps understanding and processing commands from input.");
- output.println("Goodbye.");
- }
- // Invalid Command
- else {
- System.out.println("Invalid Command: input invalid.");
- }
- } while (command.equals("QUIT") != true);
- // Close input and output
- }
- output.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement