Description
Objectives:
- Create Classes and Objects.
- Process Array of objects.
- 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 |
- 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 +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
- getCarAge() method must calculate the age of car in years and months and return data as string type.
- getCalculateGuarantee() method should calculate the reaming years and months for guarantee.
- Guarantee date should contains the years and months remain for cars from current date.
- All Output string should be printed in UPPER case.
- 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 :
- public static void printCarsInfo( Car [ ] cars){
//print all information about cars with ages and guarantee due to.
}
- 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
- 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 ].


