السلام عليكم و رجمة الله و بركاته
محتاجة مساعدة في حل واجب ،، عندي خلفية عن الموضوع و حاولت أحله بس قدرت أحل الأشياء البسيطة اللي فيه و بس ،، و في أشياء ما فهمتها من الأساس يا ليت حد يقدر يشرح لي المطلوب بحيث إني أحاول أحله مرة ثانية ،، أما عن السؤال فراح أدرج الجزء اللي ما فهمته : ا
(1) A class called: Item this has three data fields: name, price, and quantity. The constructor is used to initialize the three data fields. The item name is passed as a parameter to the constructor and the price (integer number from 2 to 6 DHs), as well as the quantity (integer number from 1 to 4) are internally generated using random number generator. The following random number generator :
int y = 1 + (int) (Math.random( ) * 99);
اللي ما فهمته من السؤال تحته خط يعني هو كيف يحدد السعر للي راح يدرجه المستخدم ، أما عن الكود الأخير فما عرفت وين أضيفه بالضبظ و الـ(الواي) شو المقصود فيها بالضبط ( بترجع للسعر أو المقدار )؟؟،، يا ليت حد يساعدي على فهمه بسرعة لأني لازم أسلمه يوم الأحد ،، و هذي هي محاولتي للحل،، طبعاً بدون المطلوب اللي ما استوعبته :wacko: ،،
public class Item {
private int price;
private String name;
private int quantity;
public Item(int price, String name,int quantity) {
this.price = price;
this.name = name;
this.quantity =quantity;
}
منتظرة مساعداتكم ،، -_-
