Sei sulla pagina 1di 8
INTL Intemational College Subang. aK FINAL Examination Paper (COVER PAGE) Session annary 2014 Programme Diploma In information and Communications Technology (iciNmicrh, Diploma In Networking and Security Course 1CT21001CSC2100 : Object-Oriented Programming €SC2114 Java Programming Date of Examination Masch 10,2014 (Mondsy) Time 2:00 pm 00 pm_Reading Time Nit Destin 2ous Special Knsteustions “This paper consists of SIX (6 questions. Answer any ROUR (4) questions in the answer booklet provided. Materials peste [Non-Programmable Calculator Materials provide wil Examiner (3) Ms Ng Ruoh Ling Moderator Dr Ang Tan Fong, ‘This pape consists of8 printed pages, including the cover page. ICT2IADICSCALOOICSC2I14(E) /Page | of? INTHINTERNATIONAL ‘OLLBCE SUBANG. DIPLOMA IN INFORMATION AND COMMUNICATION TECHNOLOGY (DICEN/DICTH) DIPLOMA IN NETWORKING AND SECURITY (DNSO, ICT2100/C822100 : OBJECT-ORIENTED PROGRAMMING (CSC2114 : JAVA PROGRAMMING FINAL EXAMINATION: JANUARY 2014 SESSION Instructions: This paper consists of SIX (6) questions. Answec any FOUR (4) questions inthe answer booklet provided. Al question cary equal mari. Question 1 () Assuming all variables used are declted and iniilized, identify the syntax errs in the following statements. Write the comectsiatement foreach, tnt num=2; loa naxdnuml*0.57 (At (ager=657 System-out .printin("Senior citizen"); else System.out printin("Wot senior citizen"); Gi) tne 1) mean: pnumt-new nt (10) int () mas smum2-(1,2,344) 912 (double betancen1234..95: Aint value= (double) batance? (public veid aday ine a, int by int ©) ‘a-btes , (Wi) class A extends B public AQ ( x= 20 super (10) (12:marks) ICT2IMNICSC2I0OICSC2ILAEH / Page 2 0f 7 (W) A boitle dink is sold n package of 6 (package consists of 6 bottles). Bach package is RM 24:50. Write a program that reads the number of bottles needed. ‘The program thea caleulies and displa’show many packages to puecase and the total charge. (marks) (©) Write program sith loop statement that will print the following series of numbers with ‘only one print statemert: 0°26 12 2 30 42 (mats) Question 2 (8) A company is selling X brand water filter at the price of RM 979 pee unit, The salespersons receive 2 commission of 5% from the total sales (otal sales = selling pre * units sold) they perform. On top of tha, they ae also given a basic salary of RM700 per month, Wite program that inputs the number of units sold by a salesperson in ¢ month sind display hisfher commission earned and total salary (basic + commission) received for the month. (@rmaris) (©) Given that the values on a series ae: 8,X, ,-2,1, ' and X are base numbers. 5 is derived from 8 ~X. Write a complete java program with ‘wwe methods: main malhod and recursive method. Use main method to read i the postion of the series requesce by the user and display the value accordingly. Use the recursive ‘method to calculate and return the value of the position requced by the weer. For example, if the user wishes fo know the value of postion 7 on the series, the recursive method will retum "16" (10 maths) (© Given public class MusicRoom extends Classtoos (©. public string gotRoonsize( ) (return Setoamize (setFurnitursMun()) : 1 , ‘With the class above, write the coresponding superclass with ‘a method setfurnieureNum( that is used to reed and return the user-iput for he number of fursitue ‘+ amethod setRoomSizeQ that is returning the Sting “big” if these are more dan 5 Furniture and "small" otherwise amas)

Potrebbero piacerti anche