


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An examination paper for the software development module sdev s3001 at cork institute of technology. Instructions for candidates, questions related to object-oriented programming and java programming, and requirements for constructors and methods. The examination is for students in the bachelor of science in computing in information technology support program, and lasts for 2 hours in the spring of 2008.
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Examinations 2007/
Module Code: SDEV S
School: Maths and Computing
Programme Title: Bachelor of Science in Computing in Information Technology Support –
Year 3
Programme Code: KITSU_7_Y
KITSE_7_Y
External Examiner(s): Mr. J. Greenslade
Mr. J. Walsh
Internal Examiner(s): Dr. J. Stynes
Instructions: Answer Question 1 and any TWO questions.
Duration: 2 HOURS
Sitting: Spring 2008
Requirements for this examination: N/A
Note to Candidates: Please check the Programme Title and the Module Title to ensure that you have received the
correct examination paper.
If in doubt please contact an Invigilator.
1 (a) Define, using UML diagrams, a hierarchy of shapes in a graphical user interface library that includes Circle and Rectangle. Include an abstract Shape class as a base class and provide each shape with a method to calculate its area and a method to draw it on screen. Include attributes colour (“white”, “green”, “red”, etc.), name (“shape”, “circle”, “rectangle”, etc.) and (^) filled (true, false) for all shapes. It is also required to keep track of how many Circle instances have been created and to provide a method for returning this value. There is no need to write any Java code. (14 mark
(b) The Shape class has only one constructor. This constructor takes one String parameter cc and one Boolean parameter ff , and assigns cc as the value of the colour attribute and ff as the value of filled. Implement this constructor in Java. (6 marks)
(c) Assuming Shape only has the one constructor defined in (b), define in Java two constructors for the Circle class to enable developers to write code such as Circle x = new Circle(5); //creates an instance of a Circle object with radius 5, //name = “circle”, colour = “blue”, filled = false
Circle y = new Circle(4, “green”, true); //creates an instance of a Circle object //with radius 4, name = “circle”, colour = “green”, filled = true (14 marks)
(d) Explain what is meant by run-time polymorphism. Distinguish between static and dynamic binding. (6 marks)
(e) Demonstrate how static binding works by writing Java code to create an instance of a Rectangle object and an instance of a Circle object and sending each instance a message to return its area.. (5 marks)
(f) Demonstrate how dynamic binding works by writing Java code to create an instance of a Rectangle object and an instance of a Circle object and sending each instance a message to return its area. (5 marks)
4 Write a Java program FindWords that prints the number of distinct words and the words themselves in a given argument list. You may use any Class from the Java Collection Framework but you must use an iterator rather than a for-each construct to traverse the container. For example java FindWords count count many count count how many should return an output such as the following: 3 distinct words: count many how (25 marks)
5 Write a Java program that obtains a student’s ten assessment marks from an Input Dialog Box and outputs his grade in a Message Dialog Box. Use an array to store and process the marks. The ten assessment marks are added and the total is divided by 10 to give the average mark. The grade equivalent of the average mark is as follows: 80-100 A 70-79 B+ 60-69 B 55-59 B- 50-54 C+ 40-49 C 35-39 D 0-34 F (25 marks)