Bot program to count the products bought in the supermarket. with total sum.
package com.company; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { ArrayList<String> products = new ArrayList<>(Arrays.asList("banana", "apple", "orange", "pineapple", "kiwi", "grapefruit")); System.out.println("Welcome to the market"); Scanner market = new Scanner(System.in); int totalSum = 0; while (true) { System.out.println("enter the products that you want to buy"); String product = market.nextLine(); if (!products.contains(product)) { System.out.println("we don't have " + product); continue; } System.out.println("how many " + product + " do you want to buy"); int quantity = market.nextInt(); totalSum += quantity; market.nextLine(); System.out.