Week 02 : Programming Assignment 1
Complete the code segment to call the method display() of class Former first and then call display() method of class Latter.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | This is Former Class.\n
This is Latter Class. | This is Former Class.\n
This is Latter Class. | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 02 : Programming Assignment 2
Create a class Student with private attributes for name and age.
Use a constructor to initialize these attributes and provide public getter methods to access them.
In the main method, an instance of Student is created and the student's details are printed.
Guideline to Solve:
§ Define the Student class with private attributes.
§ Use a constructor to initialize the attributes.
§ Implement getter methods for the attributes.
Follow the naming convetion used in the Fixed code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | Alice
20 | Student Name: Alice\n
Student Age: 20 | Student Name: Alice\n
Student Age: 20 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 02 : Programming Assignment 3
Create a class Rectangle with attributes length and width.
Provide two constructors: one with no parameters (default to 1) and
another with parameters to initialize the attributes.
Use the this keyword to avoid name space collision.
Create a getArea() function that returns the area of the rectangle.
Guideline to Solve:
§ Define the Rectangle class with attributes and constructors.
§ Define a default Rectangle constructor that inializes length and width to 1.
§ Use the this keyword in the parameterized constructor.
§ Define a getArea() funtion that returns the area of there rectangle
Follow the naming convetion used in the Fixed code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 2.5
3.5 | Default Rectangle: L, W, A : 1.0, 1.0, 1.0\n
Parameterised Rectangle: L, W, A : 2.5, 3.5, 8.75 | Default Rectangle: L, W, A : 1.0, 1.0, 1.0\n
Parameterised Rectangle: L, W, A : 2.5, 3.5, 8.75 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 02 : Programming Assignment 4
Create a class Circle that encapsulates the properties of a circle.
The class should have a private field for the radius, a constructor to initialize the radius, and methods to calculate the area and circumference of the circle.
NOTE: use Math.PI for PI calculations (DO NOT USE 22/7)
Guideline to Solve:
§ Define the Circle class with attributes and constructors.
§ Use the this keyword in the parameterized constructor.
§ Define a getArea() funtion that returns the area of there Circle (use Math.PI)
§ Define a getCircumference() funtion that returns the circumference of there Circle (use Math.PI)
Follow the naming convetion used in the Fixed code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5.0 | Area: 78.54\n
Circumference: 31.42 | Area: 78.54\n
Circumference: 31.42 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 02 : Programming Assignment 5
Complete the code by creating the constructor and the getter functions for a class Dog as defined below.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | Tommy
German Shepard
2
Black | Hi my name is: Tommy\n
My breed is: German Shepard\n
My age is: 2\n
My color is: Black | Hi my name is: Tommy\n
My breed is: German Shepard\n
My age is: 2\n
My color is: Black | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
No comments