Você está na página 1de 6
Ieeatona Coleg Subang 1 Een: FINAL, Fxamination Paper (COVER PAGE) Session August 2011 Programme Diploma In Information and Communication Technology ICTDICH Course €5C2100 : Object-Oriented Programming Date of Examination December 6,2011 (Tuesday Time 2:00 pra 400 pm ___Reaing Time Nil Duration 2 Hows ‘Special Instructions “This paper consits of SIX () questions. Answer any FOUR (4) questions inthe answer booklet provided. All questions cary equal marks ‘Materials permitted Ni ‘Materials provided Nil Examiner (9) 5 _MsNg Ruoh Ling Moderator [Ms Che Fuslina Mohd Fuad ‘This paper consists of6 printed pages, including the cover page €SC2100 (F) Page 1 of 5 INT: INTERNATIONAL COLLEGE SUBANG DIPLOMA IN INFORMATION AND COMMUNICATION TECHNOLOGY PROGRAMME wicrpicry, CSC2100 : OBJECT-ORIENTED PROGRAMMING FINAL EXAMINATION: AUGUST 2011 SESSION Instructions: This paper censists of SIX (6) questions, Answer any FOUR (4) questions in the answer booklet provided, All questions carry equal marks, Question 1 @ © © ‘Write method Multiple that determines wheter the scond integer is a mulkiple ofthe fist integer. The method takes two integer atguments and returns true ithe second isa multiple ofthe frst end false otherwise. Incorporate this method into an application that ‘puts a pair of integers and displays ithe second value is a multiple ofthe First. (Omar) Differentiate betwen d...while statement and while statement. (4 marks) ‘Write program to assign seats fora performance that will be held in @ small hall. The {otal numberof sets ie 200 where VIP seats are seats | to 50 and normal seats are seats 51 (0200, The seat munber will be assigned in sequence (1 to 50 for VIP seats and 51 10 200 for normal seats The program allows selection of seat type (VIP or normal) before ‘assigning the seat number and promps the user ifthe seats are sold out The program repeats untill seatsare sold out (12 marks) Question 2 @ © ‘Write @ program tha: reads 10 positive integers into an array. As each number is rea, store the number ony if is nota duplicate ora number already read Prompt the oer for nother number if tht happen, “At the end of all input, display the complete act ofthe input aumbers and the ttl ofall the numbers (12 marks) Write un inteste named Shape that ha the following members: ‘+ A fixed constant PI that olds the value of 3.142 + Anatstract method named area() Gimarks) (i) Write class Ciree that implements the interfice Shape with the following members ‘+ Aninsant variable, radius type double 4 A constructor that takes an argumcat for radius ‘method area( that rturs the formula to calculate the area oF a circle (marks) CSC2LO0 GF) / Page? of 5 ii) Write a program to instantiate an object of Cirele by reading the valu of radius from the user. Display the area ofthe cil. (marks) Question 3 @ © © ‘Create class SavingAecount that has the following members: ‘= A private instnce variable savingsBalance which is sed to indicate the amount the saver currently has on deposit + Asati variable annuallnterestRtae to store the annua interest rate for all scout holders, + An instance method ealeulateMonthly Interest to calculate the monthly interest by multiplying the savingsBalanee by annualTnterestRate sn divided by 12 ‘The imerestis added tothe savingsBalance. + A.satie method modifylnterestate o set the annuallaterestRate to & new value + An instance method getSavingsBalance to return the curent savingsBaanee sn instance method setSavingsBalanee to set the curreatsavingsBalance (Barks) Using the SavingsAecount class defined in Q3(a) shove, write an application fo test the SavingsAceount class Create two SavingsAccount objets with balance of $2,000 and $3,000 respectively. Set the annuallnterestRate to S%. Calulate and display the new balances for 12 monts for both the SavingsAeeount objects, (Smarks) Waite program that will randomly generate two positive single-digit positive integers (1 {0 9) and display them es a multiplication question tothe user. If the answer given by the user is correct, display the message “very good”, else display the message “Wrong answer”. Run the maltiplicaton test for 10 times and display’ the number of eorret and incomect responses athe end of the test (marks)

Você também pode gostar