Week 04 : Programming Assignment 1
Complete the code segment to swap two numbers using call by object reference.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5 10 | Before Swap: 5 10\n
After Swap: 10 5 | Before Swap: 5 10\n
After Swap: 10 5 | Passed |
Week 04 : Programming Assignment 2
1 - Problem Statement:
Define a class Point with members
§ private double x;
§ private double y;
and methods:
§ public Point(double x, double y){} // Constructor to create a new point?
§ public double slope(Point p2){} // Function to return the slope of the line formed from current Point and another Point
(Assume that input will always be chosen so that slope will never be infinite)
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 0 0
1 1 | Slope: 1.0 | Slope: 1.0 | Passed |
Week 04 : Programming Assignment 3
This program to exercise the create static and non-static methods. A partial code is given, you have to define two methods, namely sum( ) and multiply( ). These methods have been called to find the sum and product of two numbers. Complete the code segment as instructed.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5 10 | Sum: 15\n
Product: 50 | Sum: 15\n
Product: 50 | Passed |
Week 04 : Programming Assignment 4
The program in this assignment is attempted to print the following output:
-----------------OUTPUT-------------------
This is large
This is medium
This is small
This is extra-large
-------------------------------------------------
However, the code is intentionally with some bugs in it. Debug the code to execute the program successfully.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | This is large\n
This is medium\n
This is small\n
This is extra-large | This is large\n
This is medium\n
This is small\n
This is extra-large | Passed |
Week 04 : Programming Assignment 5
Consider First n even numbers starting from zero(0).Complete the code segment to calculate sum of all the numbers divisible by 3 from 0 to n. Print the sum.
Example:
Input: n = 5
-------
0 2 4 6 8
Even number divisible by 3:0 6
sum:6
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 6 | Sum: 6 | Sum: 6 | Passed |
No comments