私はこのコードを書きました:
Scanner askPrice = new Scanner(System.in);
for(double i = 0 ; i < 3; i++);
{
double totalInitial = 0.00;
System.out.println("Enter the price for your item. "
+ "Press enter after each entry. Do not type the '$' sign: ") ;
double price1 = askPrice.nextDouble(); //enter price one
double price2 = askPrice.nextDouble(); //enter price two
double price3 = askPrice.nextDouble(); //enter price three
double total = ((totalInitial) + (price1) + (price2) + (price3));
for ループを while ループに変更して、センチネル値までアイテムの価格 (double の入力) をユーザーに尋ねたいと考えています。これどうやってするの?既に 3 回の繰り返しが設定されていることはわかっていますが、事前に設定された繰り返し回数がないコードを変更したいと考えています。どんな助けでも大歓迎です。