السلام عليكم
Write a program for a grocery that reads products data and determine and display the product that has the highest price and the average price. A product has three pieces of data: id name and priceYour program should continue reading new products until user enters -1 as id of a product
الكــود الذي عملته
import java.util.*;
public class try1{
static Scanner console = new Scanner(System.in);
static final int SENTINEL = -1;
public static void main (String[] args){
int id =0;
double sum = 0;
do {
System.out.print("Enter a beoduct id: ");
id =console.nextInt();
System.out.print("Enter a broduct name: ");
String name = console.next();
System.out.print("Enter a broduct price: ");
double price = console.nextDouble();
}
while(id !=-1);
}
}