64252616-Asg-JAVA-1 - TCS2044/SCS2034 JAVA PROGRAMMING...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
TCS2044/SCS2034 JAVA PROGRAMMING ASSIGNMENT 1 MAY 2011 Due date: 26 August 2011 Weighting: Part of 15% of overall assessment. Environment: You are required to do this assignment in Java environment. You may use pieces of code from the lectures, books, and elsewhere giving appropriate references. Assessment Your assignment will be assessed for the following: Correctness of the programs Sample test data/results/output or discussion of results Submission You are required to submit documentation in the form of printed copy of your codes and sample test data. Your submission should bind together with the assignment cover given at the end of this assignment question. Use YELLOW colour paper as your Assignment 1 cover . Warning 1. You are required to do the assignment on your own. 2. Plagiarism or late submission will be penalised.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Question 1 Define a class named Circle with the following properties: A data field named radius of type double with protected access modifier, and a String data field named colour with private access modifier. Both data fields specify the radius and the colour of the Circle object respectively. A private static constant named PI with a fixed value of 3.142 that represents the value of pi. A default Circle constructor. A constructor that creates Circle objects with the given radius value as the argument. A public method to display the Circle object’s data fields. A public method named changeColour(String) to change the value of the Circle object’s colour based on the value in the method argument. A public method named getSurfaceArea() that calculates and returns the surface area of the Circle object. Use the constant PI value for the calculation. (a) Write another class named TestCircle to test the Circle program by creating two Circle objects. The first object must be created using the default constructor, while the second object must be created with the radius value of 10. (b)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/14/2011 for the course ECE 604 taught by Professor Kumar during the Spring '11 term at Indian Institute of Technology, Kharagpur.

Page1 / 13

64252616-Asg-JAVA-1 - TCS2044/SCS2034 JAVA PROGRAMMING...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online