تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-15
السؤال
Transcribed Image Text:
Palestinian Car Agency:
A car has many attributes. Consider underneath car has the following attributes
Plate No
Year manufacture
Month manufacture
color
price
Manufacture by
Guarantee due to year
Guarantee due to month
0123-A
Current year
Current moth
red
50,000.00
Mercedes
Current year
Current moth+6
✰ Create a car class using at least the following 8 attributes: Plate No, Year manufacture, Month
manufacture, color, and price. Note that both current year and moth are read from system.
Create two constructors as follow:
No-argument constructor: that creates a car object using the default "Mercedes Benz" values in above
example.
A constructor with arguments using the basic 8 attributes that mentioned before.
* Your assignment should use the following two chart of UML:
Car
-PlateNo: String
-yearmanufacture: int
-monthmanufacture:int
-color: String
-price: double
-manufactureby: String
-guaranteedueyear: int
-guaranteeduemonth: int
+Car()
+Car (String PlateNo, intyearmanufacture, int
monthmanufacture, String color, double
price, String manufactureby, guaranteedueyear
int, guaranteeduemonth int)
+getYearManufacture () : int
+getMonthManufacture () : int
+getColor(): String
+get Price (): double
+setYearManufacture (int year):void
+setMonthManufacture (int month):void
+setColor (String color):void
+setGuarantee (int month, int year):void
+getCarAge () : String
+printCarInfo(): String
+getmanufactureby(): String
+getCalculateGuarantee () : String
Class Driver for Palestinian Car Agency:
Note that
1. getCarAge () method must calculate the age of car in years and months and return data
as string type.
2. getCalculateGuarantee () method should calculate the reaming years and months for
guarantee.
3. Guarantee date should contains the years and months remain for cars from current date.
4. All Output string should be printed in UPPER case.
5. print all information about cars with ages and guarantee due to inside class driver.
Write a driver class that creates an array of 5 [ do not create scanner, initialize them inside class driver] Cars then passes the
array to the two underneath methods:
1. public static void print Cars Info ( Car [ ] cars) {
}
//print all information about cars with ages and guarantee due to.
2. a method named MaxPrice which will return the car object with the maximum price.
public static Car maxPrice ( Car [ ] cars) {
}
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.