Cruz Castillo

Generation

generate functionThu, 04 May 2023

Bot program to count the products bought in the supermarket. with total sum.

import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Map<String, Integer> products = new HashMap<String, Integer>(); System.out.println("Введите список продуктов и их цену в формате <название> <цена>"); String product = ""; String price = ""; String totalPrice = "0"; Scanner scanner = new Scanner(System.in); while (true) { String line = scanner.nextLine(); if (line.equals("стоп")) { break; } String[] parts = line.split(" "); if (parts.length != 2) { System.out.println("Нев

Want to kickstart your project?Use the new AI Studio to create your code