Jumpinjava.cpp This Program Looks Up And Prints The Names And Prices Of Coffee Orders.

Jumpinjava.cpp This Program Looks Up And Prints The Names And Prices Of Coffee Orders. Rating: 5,0/5 406 votes

Printing options: They focus on dye sublimation all-over-print (hence the name) and direct-to-garment printing. Unique features: Include your own custom packing slip in orders. You can also unlock discounts of up to 10% off, along with other custom branding options, like packaging stickers and private labeling features, with their paid plans. Raw download clone embed report print text 1.70 KB // JumpinJive.java - This program looks up and prints the names and prices of coffee orders. // Input: Interactive.

Download

  1. // JumpinJive.java - This program looks up and prints the names and prices of coffee orders.
  2. // Output: Name and price of coffee orders or error message if add-in is not found.
  3. import java.util.Scanner;
  4. public class JumpinJive
  5. public static void main(String args[]) throws Exception
  6. // Declare variables.
  7. final int NUM_ITEMS = 5; // Named constant
  8. String addIns[] = {'Cream', 'Cinnamon', 'Chocolate', 'Amaretto', 'Whiskey'};
  9. double addInPrices[] = {.89, .25, .59, 1.50, 1.75};
  10. int x; // Loop control variable.
  11. double orderTotal = 2.00; // All orders start with a 2.00 charge
  12. // Get user input.
  13. System.out.print('Enter coffee add-in or XXX to quit: ');
  14. // Write the rest of the program here.
  15. {
  16. }
  17. for (x = 0; x < NUM_ITEMS; x++)
  18. if (foundIt)
  19. break;
  20. if (addIn addIns[x])
  21. foundIt = true;
  22. }
  23. if (foundIt)
  24. System.out.println(addIn + ' costs $' + addInPrices[x - 1] + '.');
  25. System.out.println('Total cost is $' + orderTotal + addInPrices[x - 1] + '.');
  26. else
  27. System.out.println('Sorry we do not carry that.');
  28. } // End of JumpinJive class.
  1. // JumpinJava.cpp - This program looks up and prints the names and prices of coffee orders.
  2. // Output: Name and price of coffee orders or error message if add-in is not found
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. // Declare variables.
  7. const int NUM_ITEMS = 5; // Named constant
  8. string addIns[] = {'Cream', 'Cinnamon', 'Chocolate', 'Amaretto', 'Whiskey'};
  9. double addInPrices[] = {.89, .25, .59, 1.50, 1.75};
  10. int x = 0; // Loop control variable
  11. double orderTotal = 2.00; // All orders start with a 2.00 charge
  12. // Get user input
  13. cin >> addIn;
  14. // Write the rest of the program here.
  15. {
  16. }
  17. for (x = 0; x < NUM_ITEMS - 1; x++)
  18. if (addIn addIns[x])
  19. cout << addIn << ' costs $' << addInPrices[x] << '.' << endl;
  20. cout << 'Total cost is $' << orderTotal + addInPrices[x] << '.' << endl;
  21. else
  22. cout << 'Sorry we do not carry that.' << endl;
  23. }
  24. return 0;