daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest May 16th, 2018 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Vector;
  2. import java.io.*;
  3. public class FoodOrder  
  4. {
  5.     Vector FoodOrder = new Vector();
  6.     boolean completed = false;
  7.  
  8.     public void addFood()
  9.     {
  10.         try
  11.         {
  12.             BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  13.             int food;
  14.             int counter = 0;
  15.             food = Integer.parseInt( in.readLine());
  16.             FoodOrder.add(counter, food);
  17.             counter++;
  18.         }
  19.         catch(Exception er) {er.printStackTrace();}
  20.     }
  21.    
  22.     public void removeFood()
  23.     {
  24.      Object remove = 0;  
  25.      try
  26.      {
  27.          BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
  28.         remove = Integer.parseInt( in.readLine());
  29.      }
  30.      catch(Exception er) {er.printStackTrace();}
  31.        
  32.      for(int i=1; i<=FoodOrder.size(); i++)
  33.      {
  34.          Object fooditem = FoodOrder.get(i-1);
  35.          if(fooditem == remove)
  36.             {FoodOrder.remove(i-1);}
  37.          else
  38.             {/*return item not found?*/}
  39.      }
  40.     }
  41.  
  42.     public void cancelFoodOrder()
  43.     {
  44.         FoodOrder.clear();
  45.     }
  46.  
  47.     public void setAsCompleted()
  48.     {
  49.         boolean complete = true;
  50.     }
  51. }
RAW Paste Data
Top