$30
Objectives:
1. Create Classes and Objects.
2. Process Array of objects.
3. To use the String class to process immutable strings.
Palestinian Car Agency:
A car has many attributes. Consider underneath car has the following attributes
Plate No
0123-A
Year manufacture
Current year
Month manufacture
Current moth
color
red
price
50,000.00
Manufacture by
Mercedes
Guarantee due to year
Current year
Guarantee due to month
Current moth+6
v 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.
v 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.
v 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
+getPrice():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 printCarsInfo( 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) {
}
Set of instructions:
1.Create folder at your desktop with your Assignment#, ID, and your name Example:A2_1190100_AliMohammad
2. Create a new project using Eclipse IDE and store your project inside this folder.
3.Zipped this folder and submit it by your ITC account [under meta course ].