Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class schoolKiosk {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String snacks [] = {"Ruffles chips", "Pepsi", "Coke", "Oreo cookies", "Snickers", "Clark's bar", "7 up", "Muffins", "Natural orange", "Natural apple"}; //snacks available
- 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
- int stockLeft [] = {10, 20, 11, 9, 15, 23, 22, 18, 10, 10}; //how many of each is left in stock
- printInventory(snacks, price, stockLeft);
- } // main ends here
- static void printInventory(String[] snacks, double[] price, int[] stockLeft)
- {
- for(int i = 0; i<snacks.length; i++)
- {
- if(price[i]>10.00 && stockLeft[i]<20)
- {
- System.out.println(snacks[i]);
- }
- }
- }
- } // program ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement