Please scroll down for latest Programs. 👇
Week 01 : Programming Assignment 1
Write a Java program to check if a given integer is “Positive” or “Negative”.
(0 (Zero) should be considered positive by this program.)
NOTE:
The code you see is not complete.
Your task is to complete the code as per the question.
Think of it like a programming puzzle.
(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 | 4 | Positive | Positive | Passed |
Test Case 2 | -3 | Negative | Negative | Passed |
Week 01 : Programming Assignment 2
Write a Java program to calculate the volume of a cylinder given its radius and height.
Formula:
You can use Math.PI for the computation.
NOTE:
The code you see is not complete.
Your task is to complete the code as per the question.
Think of it like a programming puzzle.
(This question can be solved in just one line of code)
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 3.5
5.0 | Volume is: 192.42 | Volume is: 192.42 | Passed |
Week 01 : Programming Assignment 3
Write a Java program to print the multiplication table of a given number up to 4.
NOTE:
Print EXACTLY as shown in the sample output.
DO NOT MISS a single space otherwise you will not be scored.
(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 | 5 | 5 x 1 = 5\n
5 x 2 = 10\n
5 x 3 = 15\n
5 x 4 = 20 | 5 x 1 = 5\n
5 x 2 = 10\n
5 x 3 = 15\n
5 x 4 = 20\n
| Passed after ignoring Presentation Error |
Week 01 : Programming Assignment 4
Complete the code fragment that reads two integer inputs from keyboard and compute 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 01 : Programming Assignment 5
Write a Java program to print the area and perimeter of a rectangle.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5.6 8.5 | Perimeter is 2*(8.5 + 5.6) = 28.20\n
Area is 5.6 * 8.5 = 47.60 | Perimeter is 2*(8.5 + 5.6) = 28.20\n
Area is 5.6 * 8.5 = 47.60 | Passed |
W02 Programming Assignments 1
Write a Java program to calculate the area of a rectangle.
The formula for area is:
Area = length × width
You are required to read the length and width from the user, compute the area, and print the result.
This task helps you practice using variables, arithmetic operations, and printing output in Java.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5
10 | Area is: 50 | Area is: 50 | Passed |
W02 Programming Assignments 2
Problem Statement
Write a Java program to calculate the perimeter of a rectangle.
The formula for perimeter is:
Perimeter = 2 multiplied by (length + width)
You are required to read the length and width as integers from the user, compute the perimeter, and print the result.
This problem helps in practicing arithmetic operations and output printing in Java.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 4
6 | Perimeter is: 20 | Perimeter is: 20\n
| Passed after ignoring Presentation Error |
W02 Programming Assignments 3
Finding the Maximum Element in an Array
Problem Statement
What is the Maximum Element?
In an array of numbers, the maximum is the largest number among all elements.
In this assignment:
You will read
n
numbers from the userStore them in an array
Find the largest number among them
Print the maximum number
This task helps you apply loops and arrays together to solve a real logic-based problem.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5
15 42 9 28 37 | Maximum is: 42 | Maximum is: 42\n
| Passed after ignoring Presentation Error |
W02 Programming Assignments 4
Create a Class and Access Its Member Variable
Problem Statement
In this task, you will practice creating and using a class in Java.
You need to:
Create a class called
Rectangle
Declare two integer member variables
length
andwidth
In the
main
method, create an object of theRectangle
class, assign values tolength
andwidth
, and print their sum
This problem helps you understand how to define a class, create objects, and access class members in Java.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5
10 | Sum of length and width is: 15 | Sum of length and width is: 15\n
| Passed after ignoring Presentation Error |
W02 Programming Assignments 5
Working with Multiple Classes, Constructors, and the this
Keyword
Problem Statement
In this task, you will learn how to:
Declare multiple classes in the same Java program
Use constructors to initialize values
Apply the
this
keyword to refer to instance variables
What you need to do:
Declare a class called
Circle
with one member variableradius
Write a constructor for
Circle
that takesradius
as a parameter and assigns it using thethis
keywordIn the
main
method, create an object ofCircle
and print its radius
This task helps understand how classes work together and how constructors and the this
keyword are used for clarity.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 7 | Radius of the circle is: 7 | Radius of the circle is: 7\n
| Passed after ignoring Presentation Error |
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.