Week 03 : Programming Assignment 1
Create a class Department having a method getCourses that prints "These are the department's courses". It will have two subclasses, ComputerScience and MechanicalEngineering, each having a method with the same name that prints specific courses for the respective departments.Call the method by creating an object of each of the three classes.
(Remember to match the output given exactly, including the spaces and new lines)
(passed with presentation error means you will get full marks)
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Courses: Data Structures, Algorithms, Operating Systems\n
Courses: Thermodynamics, Fluid Mechanics, Heat Transfer | Courses: Data Structures, Algorithms, Operating Systems\n
Courses: Thermodynamics, Fluid Mechanics, Heat Transfer\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 03 : Programming Assignment 2
There are two class cls1 and cls2 which is subclass of cls1. cls1 having a method "add" which add two numbers. Create two method inside cls2 which will take 2 parameters as input i.e. a and b and print the sum , multiplication and sum of their squares i.e (a^2) + (b2).
(Remember to match the output given exactly, including the spaces and new lines)
(passed with presentation error means you will get full marks)
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 2
4 | 6\n
8\n
20 | 6\n
8\n
20\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 03 : Programming Assignment 3
Write a program to print the factorial of a number by defining a recursive method named 'Factorial'.
Factorial of any number n is represented by n! and is equal to 1*2*3*....*(n-1)*n. E.g.-
4! = 1*2*3*4 = 24
3! = 3*2*1 = 6
2! = 2*1 = 2
Also,
1! = 1
0! = 0
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5 | 120 | 120 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 03 : Programming Assignment 4
Write a program to take integer inputs from user until he/she presses q ( Ask to press q to quit after every integer input ). Print average and product of all numbers.
(Remember to match the output given exactly, including the spaces and new lines)
(passed with presentation error means you will get full marks)
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 2
4
5
6
8
1
q | Product is: 1920\n
Average is: 4.3333335 | Product is: 1920\n
Average is: 4.3333335 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 03 : Programming Assignment 5
Write a Java program to create a class called Employee with methods called work() and getSalary(). Create a subclass called HRManager that overrides the work() method and adds a new method called addEmployee().
(Remember to match the output given exactly, including the spaces and new lines)
(passed with presentation error means you will get full marks)
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | working as an employee!\n
Employee salary: 40000\n
\n
Managing employees\n
Manager salary: 70000\n
\n
Adding new employee! | working as an employee!\n
Employee salary: 40000\n
\n
Managing employees\n
Manager salary: 70000\n
\n
Adding new employee! | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
No comments