Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SecondTry {
- static Scanner input = new Scanner(System.in);
- static int singleitemprice = 3;
- static int totalsnackQty = 5;
- static int[] coinArr = {1, 2, 3, 4, 5};
- static int[] coinQtyArr = {1, 2, 3, 4, 5};
- static int[] itemPriceArr = {1, 2, 3, 4, 5};
- static int[] itemQtyArr = {1, 2, 3, 4, 5};
- public static void main(String[] args) {
- subMenu();
- }
- private static void subMenu() {
- //int totalsnsckQty = 50; // [This variable is unused.]
- System.out.println("1 total coin un the machine");
- System.out.println("2 Profit/Losses");
- System.out.println("please enter an option");
- int option = input.nextInt();
- if (option == 0) {
- createMenu();
- } else if (option == 1) {
- double totalCoin = 0;
- for (int i = 0; i < 5; i++) {
- totalCoin += coinArr[i] * coinQtyArr[i];
- }
- System.out.println("the total coin in the machine are " + totalCoin);
- } else if (option == 2) {
- double profit = 0;
- for (int i = 0; i < 5; i++) {
- profit += (itemPriceArr[i] * itemQtyArr[i]);
- }
- double losses = (singleitemprice * totalsnackQty);
- System.out.println("the profit is " + profit + " the losses is " + losses);
- } else {
- System.out.println("invalid option please select another option");
- }
- }
- private static void createMenu() {
- // ???
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement