logo

ICT221 Object-Oriented Programming

6 Pages864 Words309 Views
   

University of the Sunshine Coast Queensland Australia

   

Object-Oriented Programming (ICT221)

   

Added on  2020-04-21

ICT221 Object-Oriented Programming

   

University of the Sunshine Coast Queensland Australia

   

Object-Oriented Programming (ICT221)

   Added on 2020-04-21

ShareRelated Documents
Section A. Multiple Choice QuestionsQuestion No.Answer choiceAnswer1CPlatform-independent2Da and b 3Eencapsulation4DProduct Quality with less defects5CHuman user to system interaction6DGlobal variables7AReal world entity8ENone of the above9BVerify the project purpose10BJunit11ABlock, line and javadoc12BTranslates java source code to byte code13EA class can extend one class and implement many interfaces14AVoid15DWon't compile because of line (5), constructor can't be static16DCompilation Error17AMethod 118BHellow19Cjavafx.scene.layout.BorderPane20Cwhenever the pane is resized, the rectangle will move to the centre of the pane21Conetwo
ICT221 Object-Oriented Programming_1
Section B. Short Answer QuestionsQ 22. This is a simple implementation of Shape interface to make a Square class.This class has a private member side that is getting initialized through a parameterized constructor.If this side length is less then or equal to 0, then it throws an IllegalArgumentExceptionA square has 4 sides ,so int numberOfSides() returns 4.getPerimeter() function returns 4* side as the perimeter of a square is4* its side.getArea() return side * side as its area.publicclass Square implements Shape {/** * side of the square */privatedoubleside;/** * Initializes the side of the square * @param side side of the square */public Square(doubleside){if(side<=0)thrownew IllegalArgumentException ();this.side=side;}@Overridepublicint numberOfSides() {return 4;}@Overridepublicdouble getPerimeter() {return 4*side;}@Overridepublicdouble getArea() {returnside*side;}}
ICT221 Object-Oriented Programming_2
Q23.
ICT221 Object-Oriented Programming_3

End of preview

Want to access all the pages? Upload your documents or become a member.