Advertisement
oona

school kiosk

Mar 4th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. public class schoolKiosk {
  2.  
  3.     public static void main(String[] args) {
  4.         // TODO Auto-generated method stub
  5.        
  6.         String snacks [] = {"Ruffles chips", "Pepsi", "Coke", "Oreo cookies", "Snickers", "Clark's bar", "7 up", "Muffins", "Natural orange", "Natural apple"}; //snacks available
  7.         double price [] = {13.99, 13.10, 13.10, 9.99, 11.20, 10.20, 12.30, 10.20, 9.99, 9.99}; //price in Danish crowns
  8.         int stockLeft [] = {10, 20, 11, 9, 15, 23, 22, 18, 10, 10}; //how many of each is left in stock
  9.        
  10.         printInventory(snacks, price, stockLeft);
  11.  
  12.     } // main ends here
  13.    
  14.     static void printInventory(String[] snacks, double[] price, int[] stockLeft)
  15.     {
  16.         for(int i = 0; i<snacks.length; i++)
  17.         {
  18.             if(price[i]>10.00 && stockLeft[i]<20)
  19.             {
  20.                 System.out.println(snacks[i]);
  21.             }
  22.         }
  23.     }
  24.    
  25.  
  26. } // program ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement