السلام عليكم ورحمة الله وبركاته
اخواني كتب هذا البرنامج البسيط لادخال اسم بضاعه وثم ادخال سعرها وفي النهايه حساب السعر كامل ولكن البرنامج فقط يظهر ادخال اسم البضاعه مره واحد ف ما الحل؟؟!!
// This programe to calculate the expenditure per month
import java.util.*;
public class Expenditure{
public static void main(String[] args){
String name;
double money;
double sum=0.0;
Scanner scan=new Scanner(System.in);
do{
System.out.println("Enter the goods' name");
name=scan.nextLine();// to enter the goods' name
System.out.println("Enter 0 to finish this loop");// to inform the user that the loop will stop whin he/she enter 0
System.out.println("Enter the cost of this thing");
money=scan.nextDouble();// to enter cost of that good
System.out.println(name+ "and it's cost is" +money);// to display the good with its' cost
sum=sum+money;//to calculate the total of all price
}while(money !=0);
System.out.println("The Final Total of all this things is" +sum); //to display the final price
}
}