0% found this document useful (0 votes)
10 views2 pages

(2023-2024) Lab Test Solution and Detailed Scale (2nd Computer Science Ingeneering)

structure
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

(2023-2024) Lab Test Solution and Detailed Scale (2nd Computer Science Ingeneering)

structure
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
University of Tlemcen 21/Semester1 07/12/2023 College of Sciences 7 Department of Computer Sciences Ah Lab test: Object Oriented Programming 1 - Duration: 1h ‘e Student Name: Group: Exereise 1 (5 marks): Given the following java code, run it manuelly and display the different results: ‘The Traffie,java file class TrafficLightf private int color; private int position ; private static double height = 9.0; Public TrafficLighi(intintColor) { color = initColor; position = 0 ;} public TrafficLight(ine initColor, int initPosition) {color = initColor; position = initPosition ;} ‘public static vold setHetght(double newHeight) {height = newHleight;} public void changeColor (int newColor) {color = newColor:System.out.printin("My color is : “+ color):} ‘Public static void getFeight() (System. out.printin("My height is :"+ height);} public void flash@) { ‘System. cut println( "First way to flash’), Results Jor (int a=0; a€2; a++) { ‘Nefcolor is 2) oS ‘ar (int b=0; <2; b+) y color is : vé ‘System.out.printin("T am off”) My height is 72 Jor (int b=0; b<3; b+) My height is : a2 ‘Sysiem.out.printin("T am on"):)} Second way to flash 0, 5 i vlan a ai Tantr, / R A stem. out,priniln("Second way to flash"); = rs ” for (Int a0; 082; a+) { Tamon FO US Cac “Jor (int b=0; b

You might also like