Week 6 : Programming Assignment 1
Due on 2024-03-14, 23:59 IST
Complete the code fragment to read two integer inputs from keyboard and find the quotient and remainder.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 556
9 | The Quotient is = 61\n
The Remainder is = 7 | The Quotient is = 61\n
The Remainder is = 7 | Passed |
Week 6 : Programming Assignment 2
Due on 2024-03-14, 23:59 IST
Complete the code segment to count number of digits in an integer using while loop.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 153 | 3 | 3 | Passed |
Test Case 2 | 0003452 | 4 | 4 | Passed |
Week 6 : Programming Assignment 3
Due on 2024-03-14, 23:59 IST
Complete the code segment to display the factors of a number n.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 18 | 1 2 3 6 9 18 | 1 2 3 6 9 18 | Passed |
Week 6 : Programming Assignment 4
Due on 2024-03-14, 23:59 IST
Complete the code segment to find the standard deviation of the 1-D array.
Use the following formula:
Here,
Use the following formula:
Here,
σ = Population standard deviation
N = Number of observations in the population
Xi = ith observation in the population
μ = Population mean
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 10
1 2 3 4 5 6 7 8 9 10 | Standard Deviation: 2.8722813232690143 | Standard Deviation: 2.8722813232690143 | Passed |
Week 6 : Programming Assignment 5
Due on 2024-03-14, 23:59 IST
Write a program which will print a pattern of "*" 's of height "n".
For example:
Input:
n = 3
Output:
***
**
*
**
***
For example:
Input:
n = 3
Output:
***
**
*
**
***
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 6 | ******\n
*****\n
****\n
***\n
**\n
*\n
**\n
***\n
****\n
*****\n
****** | ******\n
*****\n
****\n
***\n
**\n
*\n
**\n
***\n
****\n
*****\n
******\n
| Passed after ignoring Presentation Error |
Week 7 : Programming Assignment 1
Due on 2024-03-14, 23:59 IST
A Student class with private fields (name, age) is provided,
Your task is to make the following:
- a parameterized constructor to initialize the private fields
- the getter/setter methods for each field
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | John
20 | Name: John, Age: 20 | Name: John, Age: 20 | Passed |
Test Case 2 | Alice
25 | Name: Alice, Age: 25 | Name: Alice, Age: 25 | Passed |
Week 7 : Programming Assignment 2
Due on 2024-03-14, 23:59 IST
A BankAccount class with private field balance is provided,
Your task is to make the following:
- a parameterized constructor to initialize the private field
- public void deposit(...) // to deposit money
- public void withdraw(...) // to withdraw money, should print "Insufficient funds!" if not enough money to withdraw
- public double getBalance() // to return the current balance
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 500
300
200 | Balance: 600.0 | Balance: 600.0 | Passed |
Test Case 2 | 500
100
900 | Insufficient funds!\n
Balance: 600.0 | Insufficient funds!\n
Balance: 600.0 | Passed |
Week 7 : Programming Assignment 3
Due on 2024-03-14, 23:59 IST
An abstract class shape is provided,
Your task is to make the following:
- a parameterized constructor to initialize the Circle class
- @Override the area function to compute the area of a circle (Use Math.PI for value of pi, not 22/7)
- @Override the displayInfo() function to print exactly in the format provided by the test cases.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5.0 | Circle - Radius: 5.0, Area: 78.53981633974483 | Circle - Radius: 5.0, Area: 78.53981633974483 | Passed |
Test Case 2 | 7.5 | Circle - Radius: 7.5, Area: 176.71458676442586 | Circle - Radius: 7.5, Area: 176.71458676442586 | Passed |
Week 7 : Programming Assignment 4
Due on 2024-03-14, 23:59 IST
An interface shape is provided,
Your task is to make the following:
- Create a class "Circle" that implements the "Shape" interface and provides its own implementation for calculateArea().
- @Override the area function to compute the area of a circle (Use Math.PI for value of pi, not 22/7)
- Create another class "Rectangle" that implements the "Shape" interface and provides its own implementation for calculateArea().
- @Override the area function to compute the area of a rectangle
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5.0
2.5 5.0 | Circle Area: 78.53981633974483\n
Rectangle Area: 12.5 | Circle Area: 78.53981633974483\n
Rectangle Area: 12.5 | Passed |
Test Case 2 | 0.0
0.0 0.0 | Circle Area: 0.0\n
Rectangle Area: 0.0 | Circle Area: 0.0\n
Rectangle Area: 0.0 | Passed |
Week 7 : Programming Assignment 5
Due on 2024-03-14, 23:59 IST
Two interfaces are provided, namely Flyable and Swimmable,
Your task is to make the following:
- Create a class "FlyingFish" that implements both interfaces and provides its own implementation for fly() and swim()
- It should have a private variable name, use a constructor to set the value and the functions fly() and swim() to print exactly as given in the test case.
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | John | John can glide through the air\n
John can swim in water | John can glide through the air\n
John can swim in water | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 8 : Programming Assignment 1
Due on 2024-03-21, 23:59 IST
Create a class called Animal with protected fields and a parameterized constructor to initialize the protected fields.
Fields:
- name (String)
- sound (String)
and Method:
- public void makeSound() - This method should display the name of the animal and the sound it makes.
Create a class called Dog that extends the Animal class.
The Dog class should have a constructor that accepts the name of the dog and sets the sound to "Woof".
The Dog class should have a constructor that accepts the name of the dog and sets the sound to "Woof".
Create a class called Cat that extends the Animal class.
The Cat class should have a constructor that accepts the name of the cat and sets the sound to "Meow".
Follow the naming convention as given in the main method of the suffix code.
The Cat class should have a constructor that accepts the name of the cat and sets the sound to "Meow".
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | Jacky
Tom | Jacky says: Woof\n
Tom says: Meow | Jacky says: Woof\n
Tom says: Meow\n
| Passed after ignoring Presentation Error |
Week 8 : Programming Assignment 2
Due on 2024-03-21, 23:59 IST
Program to Generate Harmonic Series.
Follow the naming convention as given in the main method of the suffix code.
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 6 | Output of Harmonic Series is 2.45 | Output of Harmonic Series is 2.45\n
| Passed after ignoring Presentation Error |
Week 8 : Programming Assignment 3
Due on 2024-03-21, 23:59 IST
Write a code to find the Trace of the 2D matrix.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5
5
2 3 5 6 7
8 9 10 11 12
13 14 15 16 17
18 1 3 0 6
7 8 11 8 11 | 37.0 | 37.0 | Passed |
Week 8 : Programming Assignment 4
Due on 2024-03-21, 23:59 IST
Program to remove duplicate elements from sorted array
Follow the naming convention as given in the main method of the suffix code.
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 6
1 2 2 3 3 4 | 1 2 3 4 | 1 2 3 4 | Passed after ignoring Presentation Error |
Week 8 : Programming Assignment 5
Due on 2024-03-21, 23:59 IST
Write a code to find the Determinant of the 2D matrix.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 4
1 0 2 -1
3 0 0 5
2 1 4 -3
1 0 5 0 | Determinant of the matrix is : 30 | Determinant of the matrix is : 30 | Passed |
No comments:
Post a Comment
Keep your comments reader friendly. Be civil and respectful. No self-promotion or spam. Stick to the topic. Questions welcome.