Вы находитесь на странице: 1из 6
INTIS COLLEGE SUBANG JAVA (aureate international Univers FINAL Examination Paper (COVER PAGE) Session Sacwary 2010 Programme Diploma in formation snd Communications Technology DICUDICT couse CSC 2100: Object-Oriented Programming Date of Examination April 22,2010 ime 00am 10:00am Reading Time: Duration 2 Hows Special Instructions “This paper consists of SIX (6) questions. Answer any FOUR (4) questions inthe answer hook provided. All questions cary equal masks, _ Materials permitted Nil Materials provided Ni Examiner Ms Siti Hawa Moderator Ms Hayprith _ ‘This paper conssis of 6 printed pages, including the cover page ©8C 21004) / Page I of 5 INTI COLLEGE SUBANGJAYA DIPLOMA IN INFORMATION AND COMMUNICATIONS TECHNOLOGY PROGRAMME qpict@micny (CSC 2100 : OBJECT-ORIENTED PROGRAMMING FINAL EXAMINATION : JANUARY 2010 SESSION Instructions: This paper consists of SIX (6) questions. Answer any FOUR (4) questions inthe answer booklet provide, All questions cary equal marks. Question (®) Explain he following concepts applied in an object-oriented programming soch as Java, (Chases and ones —Encapslatioe (i) Inheritance (marks) (>) Writea valid statement for each ofthe following (Read a character from the use using JOptionPane dialog box and assign the value toachar type variable named myChar. (i) Assign the vaue ina double type variable named bigValue «float type variable ‘aed smallValve with proper carting, (i) Read aline oftext into a variable named myLebel and convert the texto all ppercas, (marks) (©) Write Java application that allows an Intemet Service Provider to calculate its customer's monthly bill based on THREE (3) subscription packages provided. The ‘charges forthe subscription packages ae given below. ‘The application should allow the user to enter the poskage letter (A/B/C) and the number of hours that were wed. Tt should then display the total charges. Repeat for another customer and allow the user to ‘decide when to top. Package A. RMS5.00 per sn with 10 hours oF access f provided, Adkins hours are charged at RMS.(0 per hour. Package B: RMI0O.00 por month with 20 hours of seces is provided. Additional hours are charged at RMD.(0 per hour Package C: RM200.00 per month with unlimited access provided (3 masts) CSC 2100(F)/ Page? of 5 Question 2 ‘Based on the incomplete clas diagram given below, answer the following questions. Resailtem ~ description: String | ~unisOntand: nt ~ prcePerUnit: double ‘fa constructor with no arguments caleTotaPrice( void): double (@) Writ a complete clas definition for the Resilltem class above (12 mari) (©) Write TWO @) possbte overioaded constructors fr Realm class that has not been Aefined in (0). (6 maria) (©) Write statement to reatefnstantate an object from the Retail class above. ‘Then vite a code segment that updates the attibutes of the object created in) with the ‘values entered by teuser (7 marks) Question 3 (@) Write a recursive method to caleulate tho result of base", where hase and exponent ae integer valucs. Name the method as power (Smarts) (©) Declare a two dimensional array named paints to keep the points collected by 20 regular customers every tine they shop at @ shopping mall, Each row should represent 3 tstomer. ‘The umber of columns represent the ttal numberof times the customer shoo ‘This may vary fiom one customer To another. Let the user decide how many times a -evstomer shop. (marks) (6) Write an application that keeps the tot rainfall foreach of 12 months ito an aray of ‘doubles. The application should allow the user to enter the rainfall for each ofthe month. Include TWO (2) methods o resi the total eanfll forthe year, en the month with the (14 marks)

Вам также может понравиться