السلام عليكم و رحمة الله و بركاته
بالأول يسعدني الانضمام لمنتدى مهتم بالجافا و بإذن الله أستفيد منه كثير
.........
عندي اسايمنت للجافا فيه عدة اسئلة .. طبعا كبدائية ما عرفت احل غير الجزء الاول ..
يا ريت تساعدوني بالحل ..
السؤال هو :
- Create a class Company that contains:
Ø Data fields using the below specifications:
· An integer member named ID representing the ID of the Items.
· A String member named Name representing the name of the product.
· A double member named Price representing the price of the Item.
· An integer member named Discount representing the total number of Items that will have a discount.
· An integer member named NoDiscount representing the total number of Items that don’t have any discount.
Ø Methods using below details:
· Build constructor function with three parameters (arguments), after that make those parameters to forward their values to members variables (data fields) ID, Name, Price.
· A method named printInfo() to do that procedures:
a. Take array of object as parameters.
b. Print all Items details.
c. To count how many Items those apply the discount.
d. To count how many Items those apply with No discount.
Note: Discount must have the price greater than or equal 50
NoDiscount less than 50.
· The accessor and mutator methods for all data fields.
2. Write a test program that:
· Creates an Array of object named List.
· Adds any number of Items in the List array, before that ask the user, how many Items you want to enter.
· Displays (print) the final result for all Items.
يا ريت تساعدوني فيه عاجلا .. و مع الملاحظات لو تكرمتم عشان يسهل عليي الفهم ..
و في ميزان حسناتكم يا رب :)