مراجعة برمجة عملي 1
السؤال التالي كان هو السؤال الاخير في نموذج الاختبار النصفي لعام 2019-2020 لمادة CS140 لطلاب الجامعة السعودية الالكترونية
1- Create Class Fruit to represent a fruit according to the following requirements:
a. A fruit has one attribute: color
b. Add a constructor with one parameter to initialize the attribute color by specific value
c. Add the method setColor that set the color of fruit to a specific value
d. Add the method getColor that return the color of a fruit
2- Create the class FruitTester with the main method that:
a. ask the user to enter a color and save it in the variable co
b. create one fruit f3, Use co as a parameter
c. Change the color of the fruit f3
d. Print the color of f3
اجابة السؤال مشروحة في الفيديو التالي على اليوتيوب
اذا عندك سؤال او استفسار تواصل معي تحت الفيديو
أحدث التعليقات