الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

برنامج يقرأ البيانات والاسم والسعر للمتجر....

بدأه ruka في 2 ديسمبر 2010 · 0 رد · 346 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلام عليكم

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);

}
}

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…