0% found this document useful (0 votes)
4 views33 pages

Arunav Ray ISC Computer Project

This document is a project report for the ISC Computer Science practical examination by Arunav Ray, detailing various programming tasks completed during the academic year 2025-2026. It includes an index of programs, algorithms, coding examples, variable descriptions, and outputs for each task, such as time conversion, calendar display, binary search, and matrix operations. Each program is designed to demonstrate specific computer science concepts and skills.

Uploaded by

agarwalhitesh900
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views33 pages

Arunav Ray ISC Computer Project

This document is a project report for the ISC Computer Science practical examination by Arunav Ray, detailing various programming tasks completed during the academic year 2025-2026. It includes an index of programs, algorithms, coding examples, variable descriptions, and outputs for each task, such as time conversion, calendar display, binary search, and matrix operations. Each program is designed to demonstrate specific computer science concepts and skills.

Uploaded by

agarwalhitesh900
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ISC Computer Science Project

ISC COMPUTER SCIENCE


Practical Examination Project Report

Candidate Name: ARUNAV RAY

Roll Number: [To be filled]

Subject: Computer Science (Paper 2 - Practical)

Council: Indian School Certificate (ISC)

Academic Year: 2025 - 2026

ARUNAV RAY ISC COMPUTER PROJECT Page 1


INDEX OF PROGRAMS

PROG NO. PROGRAM SPECIFICATION / TITLE STATUS

Prog 16 12-Hour to 24-Hour Clock Format Converter Completed

Prog 17 Display Calendar of a Specified Month and Year Completed

Prog 18 Recursive Implementation of Binary Search Completed

Prog 19 Number Analysis: Increasing, Decreasing, or Bouncy Numbers Completed

Prog 20 Matrix Rotations (Clockwise and Anti-Clockwise) Completed

Prog 21 Spiral Matrix Generator / Traversal Completed

Prog 22 Finding the Saddle Point of a Square Matrix Completed

Prog 23 Validation and Generation of a Magic Matrix Completed

Prog 24 Pangramatic Lipogram String Tester Completed

Prog 25 Sentence Word Rearrangement by Length (Ascending Order) Completed

Prog 26 Implementation of a Stack Structure using Arrays Completed

Prog 27 Implementation of a Linear Queue Structure using Arrays Completed

Prog 28 Implementation of a Double-Ended Queue (DEQUEUE) Completed

Prog 29 Singly Linked List Implementation with Fundamental Operations Completed

Prog 30 Object-Oriented Programming: Demonstration of Inheritance Completed


PROGRAM 16: 12-HOUR TO 24-HOUR TIME CONVERTER

QUESTION

Write a program to accept a time string in the 12-hour clock format (HH:MM AM/PM) and convert it to the
international standard 24-hour clock format (HH:MM).
Example: If input time = "09:35 PM", then the output will be "21:35".

ALGORITHM
STEP 1: Start the application execution.
STEP 2: Accept a string representing time in the format HH:MM AM/PM from the user.
STEP 3: Extract hours, minutes, and the period marker (AM/PM) using substring slicing or string tokenization.
STEP 4: Convert the extracted hours and minutes substrings into integers.
STEP 5: Check the period marker: If the marker is "PM" and hours is not 12, add 12 to hours. If the marker is "AM" and
hours is 12, reset hours to 0.
STEP 6: Format the transformed integers back into a two-digit zero-padded string format (HH:MM).
STEP 7: Output the resultant 24-hour formatted time string.
STEP 8: End the execution.

CODING WITH COMMENTS

import [Link];

public class TimeConverter {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter time in 12-hour format (HH:MM AM/PM): ");
String time12 = [Link]().trim().toUpperCase();

try {
// Extract the AM/PM part
String period = [Link]([Link]() - 2);
// Extract time components
String timePart = [Link](0, [Link]() - 2).trim();
String[] parts = [Link](":");

int hh = [Link](parts[0]);
int mm = [Link](parts[1]);

// Apply 24-hour conversion rules


if ([Link]("PM") && hh != 12) {
hh += 12;
} else if ([Link]("AM") && hh == 12) {
hh = 0;
}

// Print formatted output


[Link]("Converted 24-hour format: %02d:%02d
", hh, mm);
} catch (Exception e) {
[Link]("Error: Invalid input format. Please use 'HH:MM AM/PM'.");
}
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 time12 String main() Stores the raw 12-hour input string.

2 period String main() Extracts and holds the "AM" or "PM" identifier.

3 timePart String main() Contains the time digits without the period suffix.

4 hh int main() Stores numerical representations of hours.

5 mm int main() Stores numerical representations of minutes.

OUTPUT

Enter time in 12-hour format (HH:MM AM/PM): 09:35 PM


Converted 24-hour format: 21:35

ARUNAV RAY ISC COMPUTER PROJECT Page 4


PROGRAM 17: CALENDAR DISPLAY ENGINE

QUESTION

Write a program to accept a specific month and year from the user and display its corresponding monthly calendar
layout in a classic grid format.

ALGORITHM
STEP 1: Start the execution.
STEP 2: Read the target integer values for Month and Year.
STEP 3: Compute the starting day of the week for the 1st day of the given month using Zeller's Congruence or Gregorian
calendar rules.
STEP 4: Define an array mapping the total days per month, incorporating a leap year calculation check for February.
STEP 5: Print the calendar headers (Sun, Mon, Tue, Wed, Thu, Fri, Sat).
STEP 6: Print the corresponding leading spacing shifts up to the calculated starting weekday.
STEP 7: Run a loop tracking days 1 through the maximum month days count, printing each day and inserting line-breaks
whenever a 7-day row sequence fills up.
STEP 8: End execution.

CODING WITH COMMENTS

import [Link];

public class CalendarDisplay {


// Check for leap year logic
public static boolean isLeapYear(int y) {
return (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0);
}

public static void main(String[] args) {


Scanner sc = new Scanner([Link]);
[Link]("Enter Month (1-12): ");
int m = [Link]();
[Link]("Enter Year: ");
int y = [Link]();

int[] days = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
if (isLeapYear(y)) days[2] = 29;

// Simple calculation of day of week using historical algorithm baseline


int d = 1;
int y0 = y - (14 - m) / 12;
int x = y0 + y0/4 - y0/100 + y0/400;
int m0 = m + 12 * ((14 - m) / 12) - 2;
int startDay = (d + x + (31 * m0) / 12) % 7; // 0=Sun, 1=Mon...

[Link]("
SUN MON TUE WED THU FRI SAT");
// Print leading empty spaces
for (int i = 0; i < startDay; i++) {
[Link](" ");
}

// Loop through total days of the selected month


for (int i = 1; i <= days[m]; i++) {
[Link]("%5d", i);
if (((i + startDay) % 7 == 0) || (i == days[m])) {
[Link]();
}
}
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 m/y int main() Holds the target values of Month and Year.

2 days int[] main() Array tracking the maximum total days per month element.

3 startDay int main() Calculated baseline weekday pointer for the 1st of that month.

OUTPUT

Enter Month (1-12): 6


Enter Year: 2026

SUN MON TUE WED THU FRI SAT


1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
PROGRAM 18: RECURSIVE BINARY SEARCH IMPLEMENTATION

QUESTION

Write a program to implement the classical Binary Search Algorithm recursively over an ordered data array.

ALGORITHM
STEP 1: Start execution.
STEP 2: Define a search method taking an array context, lower bounds index, upper bounds index, and search target
value.
STEP 3: Base condition: If lower index exceeds upper index, target cannot be found; return -1.
STEP 4: Compute the element midpoint pointer: mid = lower + (upper - lower) / 2.
STEP 5: Match condition: If array[mid] matches the target value, return index position mid.
STEP 6: High condition: If array[mid] exceeds the target, execute recursion on the left subarray partition.
STEP 7: Low condition: Otherwise, run recursive execution on the right subarray partition.
STEP 8: Return final output results value and terminate.

CODING WITH COMMENTS

import [Link];

public class RecursiveBinarySearch {


// Recursive search routine
public static int binarySearch(int[] arr, int low, int high, int target) {
if (low > high) {
return -1; // Element not found base case
}

int mid = low + (high - low) / 2;

if (arr[mid] == target) {
return mid; // Target matched successfully
}

if (arr[mid] > target) {


return binarySearch(arr, low, mid - 1, target); // Traverse left bounds
}

return binarySearch(arr, mid + 1, high, target); // Traverse right bounds


}

public static void main(String[] args) {


Scanner sc = new Scanner([Link]);
int[] sortedData = {12, 24, 35, 47, 58, 69, 71, 85, 96};

[Link]("Enter target element to locate: ");


int searchKey = [Link]();
int matchIdx = binarySearch(sortedData, 0, [Link] - 1, searchKey);

if (matchIdx != -1) {
[Link]("Element successfully located at zero-index: " + matchIdx);
} else {
[Link]("Element not present in the given dataset.");
}
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 arr int[] binarySearch() References the passed linear array dataset.

2 low / high int binarySearch() Boundary tracking markers for search frames.

3 mid int binarySearch() Computed middle variable pointer index.

4 matchIdx int main() Captures tracking index value from search engine execution.

OUTPUT

Enter target element to locate: 58


Element successfully located at zero-index: 4
PROGRAM 19: NUMBER CATEGORY CLASSIFIER (INCREASING,
DECREASING, BOUNCY)

QUESTION

Write a program to categorize a positive integer as an Increasing Number (each digit is greater than or equal to
the preceding digit), a Decreasing Number (each digit is smaller than or equal to the preceding digit), or a
Bouncy Number (neither purely increasing nor decreasing).

ALGORITHM
STEP 1: Start execution.
STEP 2: Accept an integer value from the user console.
STEP 3: Convert the integer into a character or string buffer format to iterate over the digits sequentially.
STEP 4: Maintain boolean tracking flags: `isInc = true` and `isDec = true`.
STEP 5: Iterate through individual consecutive pairs of digits from left to right.
STEP 6: If any left digit is greater than its right digit pair, set `isInc = false`. If any left digit is smaller than its right pair,
set `isDec = false`.
STEP 7: Analyze outcomes: If `isInc` is true, display 'Increasing'. If `isDec` is true, display 'Decreasing'. If both are false,
display 'Bouncy Number'.
STEP 8: Terminate application process.

CODING WITH COMMENTS

import [Link];

public class BouncyNumberAnalysis {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter positive number to test: ");
int num = [Link]();

String s = [Link](num);
boolean isInc = true;
boolean isDec = true;

// Scan sequential digit chains


for (int i = 0; i < [Link]() - 1; i++) {
char curr = [Link](i);
char next = [Link](i + 1);

if (curr > next) {


isInc = false; // Cannot be increasing anymore
}
if (curr < next) {
isDec = false; // Cannot be decreasing anymore
}
}
// Print evaluated classification
if (isInc) {
[Link](num + " is an INCREASING NUMBER.");
} else if (isDec) {
[Link](num + " is a DECREASING NUMBER.");
} else {
[Link](num + " is a BOUNCY NUMBER.");
}
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 num int main() Holds user given numerical workspace entry.

2 s String main() String-converted object framework version of input data.

3 isInc / isDec boolean main() Logical tracking validation flag statuses.

OUTPUT

Enter positive number to test: 13568


13568 is an INCREASING NUMBER.
PROGRAM 20: 2D MATRIX ROTATION (CLOCKWISE & ANTI-CLOCKWISE)

QUESTION

Write a program to read a square matrix configuration and display both its 90-degree Clockwise and 90-degree
Anti-Clockwise rotated configurations.

ALGORITHM
STEP 1: Start execution.
STEP 2: Accept the square array order size input constraints matrix dimension N.
STEP 3: Populate the target two-dimensional matrix array layout block frame with integer parameters.
STEP 4: To compute 90-degree Clockwise rotation, map the source element matrix at index `(row, col)` into the
destination matrix index `(col, N - 1 - row)`.
STEP 5: To compute 90-degree Anti-Clockwise rotation, map the source element matrix at index `(row, col)` into the
destination matrix index `(N - 1 - col, row)`.
STEP 6: Iterate and output both generated temporary arrays.
STEP 7: End operational execution.

CODING WITH COMMENTS

import [Link];

public class MatrixRotation {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter square dimension size N: ");
int n = [Link]();
int[][] mat = new int[n][n];

[Link]("Enter elements for matrix: ");


for(int i=0; i

VARIABLE DESCRIPTION
Sl
Name Type Method Description
No.

int[] Primary storage array for the source elements


1 mat main()
[] grid.

cw / int[] Target matrix arrays representing clockwise and


2 main()
acw [] anti-clockwise states.

Grid spatial index limits matrix dimension


3 n int main()
tracker variable.

OUTPUT

Enter square dimension size N: 2


Enter elements for matrix:
1 2
3 4

--- CLOCKWISE ROTATION ---


3 1
4 2

--- ANTI-CLOCKWISE ROTATION ---


2 4
1 3

PROGRAM 21: SPIRAL MATRIX GENERATOR

QUESTION

Write a program to generate and display a matrix of size N x N filled with sequential integers running inward in a
spiral sequence path.
ALGORITHM
STEP 1: Start execution.
STEP 2: Accept square dimension metrics matrix width N.
STEP 3: Initialize grid tracking indices variables: `top=0, bottom=N-1, left=0, right=N-1`. Initialize value counter = 1.
STEP 4: Execute loop while value counter remains lower than or equal to N * N.
STEP 5: Traverse from left boundary to right boundary along the top row; increment `top`.
STEP 6: Traverse from top boundary to bottom boundary down the rightmost column; decrement `right`.
STEP 7: Traverse from right boundary to left boundary along the bottom row; decrement `bottom`.
STEP 8: Traverse from bottom boundary to top boundary up the leftmost column; increment `left`.
STEP 9: Output final matrix allocation array data block and terminate.

CODING WITH COMMENTS

import [Link];

public class SpiralMatrixGenerator {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter structural dimension target N: ");
int n = [Link]();
int[][] spiral = new int[n][n];

int val = 1;
int top = 0, bottom = n - 1, left = 0, right = n - 1;

while (val <= n * n) {


// Traverse from left to right along the top row
for (int i = left; i <= right; i++) spiral[top][i] = val++;
top++;

// Traverse down the rightmost column


for (int i = top; i <= bottom; i++) spiral[i][right] = val++;
right--;

// Traverse from right to left along the bottom row


for (int i = right; i >= left; i--) spiral[bottom][i] = val++;
bottom--;

// Traverse up the leftmost column


for (int i = bottom; i >= top; i--) spiral[i][left] = val++;
left++;
}

// Print structural layout


[Link]("
Generated Spiral Array:");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
[Link](spiral[i][j] + " ");
}
[Link]();
}
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 spiral int[][] main() Target storage space grid matrix array frame.

2 val int main() Continuous tracking entry insertion value.

3 top/bottom/left/right int main() Boundary tracking control coordinate variables.

OUTPUT

Enter structural dimension target N: 3

Generated Spiral Array:


1 2 3
8 9 4
7 6 5
PROGRAM 22: SADDLE POINT FINDER MATRIX ENGINE

QUESTION

Write a program to find the saddle point of a square matrix. A saddle point is an element that is the minimum
element in its row and the maximum element in its column.

ALGORITHM
STEP 1: Start execution.
STEP 2: Accept row size order N inputs and construct a square grid array system.
STEP 3: Loop row index space frames cleanly tracker baseline sequence from 0 down to N.
STEP 4: In each row, locate the minimum elements item entry and note its target column pointer layout tracker.
STEP 5: Iterate through that specific column across all rows to verify if this element is also the maximum value item in
its column.
STEP 6: If both criteria are met, print the item coordinate value index and terminate.
STEP 7: If the loop completes with no match found, output an error string indicating no saddle point exists.
STEP 8: Terminate framework system.

CODING WITH COMMENTS

import [Link];

public class MatrixSaddlePoint {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter square grid dimension index bounds N: ");
int n = [Link]();
int[][] a = new int[n][n];

[Link]("Enter data elements: ");


for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = [Link]();
}
}

boolean found = false;


for (int i = 0; i < n; i++) {
int minRowVal = a[i][0];
int colIdx = 0;
for (int j = 1; j < n; j++) {
if (a[i][j] < minRowVal) {
minRowVal = a[i][j];
colIdx = j;
}
}

// Check column maximum status criteria validation mapping


boolean isSaddle = true;
for (int k = 0; k < n; k++) {
if (a[k][colIdx] > minRowVal) {
isSaddle = false;
break;
}
}

if (isSaddle) {
[Link]("Saddle Point discovered at value: " + minRowVal + " at
positional coordinate (" + i + "," + colIdx + ")");
found = true;
break;
}
}
if (!found) [Link]("No Saddle Point layout exists within this dataset
grid.");
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 a int[][] main() Internal matrix layout workspace block.

2 minRowVal int main() Tracks the smallest value element inside a row workspace loop.

3 colIdx int main() Tracks the column location of the minimum element found.

OUTPUT

Enter square grid dimension index bounds N: 3


Enter data elements:
1 2 3
4 5 6
7 8 9
Saddle Point discovered at value: 7 at positional coordinate (2,0)
PROGRAM 23: MAGIC MATRIX VALIDATOR ENGINE

QUESTION

Write a program to validate whether a user-input square matrix is a Magic Matrix. A Magic Matrix is a square
matrix where the sums of elements in each row, each column, and both main diagonals are all equal.

ALGORITHM
STEP 1: Start execution.
STEP 2: Accept square dimension N values and populate data entries matrix array.
STEP 3: Calculate baseline reference sum tracking value target from the first row sequence components block data
entries.
STEP 4: Run iteration blocks validating total sum items for each separate tracking row entries block sequence against
target constraint sum.
STEP 5: Run iteration checking total elements items value block sum for every distinct structural column configuration
against target sum.
STEP 6: Compute primary diagonal sum values and secondary diagonal layout components sums.
STEP 7: If all computed sums match the baseline reference sum, display validation success statement. Otherwise, output
a failure message.
STEP 8: Terminate operational engine workflow.

CODING WITH COMMENTS

import [Link];

public class MagicMatrixCheck {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter matrix order N: ");
int n = [Link]();
int[][] grid = new int[n][n];

[Link]("Enter grid data entries: ");


for(int i=0; i

VARIABLE DESCRIPTION
Sl
Name Type Method Description
No.

Main array block structure matrix tracker


1 grid int[][] main()
configuration data framework.

Baseline standard checksum reference value


2 targetSum int main()
parameter variable.

Status indicator flag mapping validation


3 isMagic boolean main()
sequence state tracking.

OUTPUT

Enter matrix order N: 3


Enter grid data entries:
8 1 6
3 5 7
4 9 2
The entered matrix configuration is a VALID MAGIC MATRIX.

PROGRAM 24: PANGRAMATIC LIPOGRAM STRING CHECKER

QUESTION

Write a program to check whether a given string is a Pangramatic Lipogram. A Pangram is a sentence that uses
every letter of the English alphabet at least once. A Lipogram is a text that intentionally omits a specific letter. A
Pangramatic Lipogram is a sentence that uses exactly 25 distinct letters of the alphabet (omitting exactly one
letter).
ALGORITHM
STEP 1: Start execution.
STEP 2: Read string line sequence sentence item context blocks entries text data.
STEP 3: Convert all characters cleanly into uppercase layout targets framework profiles format tracking variables.
STEP 4: Establish alpha boolean array tracker length state map 26 entries initially false.
STEP 5: Scan target line item parameters string characters sequential indexes.
STEP 6: For any letter character found between 'A' and 'Z', compute its index (`ch - 'A'`) and set the corresponding
position in the boolean array to true.
STEP 7: Count the total number of true values in the tracking array.
STEP 8: If the count of distinct letters is exactly 25, the sentence is a Pangramatic Lipogram. Output the result and the
missing letter. Otherwise, output a negative result.
STEP 9: End execution.

CODING WITH COMMENTS

import [Link];

public class PangramaticLipogramCheck {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter sentence string to test: ");
String text = [Link]().toUpperCase();

boolean[] present = new boolean[26];

// Scan sentence character contents tracking


for (int i = 0; i < [Link](); i++) {
char ch = [Link](i);
if (ch >= 'A' && ch <= 'Z') {
present[ch - 'A'] = true; // Mark letter presence
}
}

int uniqueCount = 0;
char missingLetter = ' ';

for (int i = 0; i < 26; i++) {


if (present[i]) {
uniqueCount++;
} else {
missingLetter = (char) ('A' + i);
}
}

if (uniqueCount == 25) {
[Link]("The text is a PANGRAMATIC LIPOGRAM.");
[Link]("Omitted letter token symbol is: " + missingLetter);
} else if (uniqueCount == 26) {
[Link]("The text is a Full Pangram, not a Lipogram (contains all
26 letters).");
} else {
[Link]("Not a Pangramatic Lipogram. Distinct count: " +
uniqueCount);
}
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 text String main() Primary workspace tracking entry input string placeholder block.

2 present boolean[] main() Alphabet sequence status mapping evaluation flag storage tracking index.

3 uniqueCount int main() Tracks the count of unique letters found in the text string.

OUTPUT

Enter sentence string to test: The quick brown fox jumps over a lazy dog
The text is a Full Pangram, not a Lipogram (contains all 26 letters).
PROGRAM 25: WORD SORTER BY LENGTH ENGINE FRAMEWORK

QUESTION

Write a program to accept a sentence from the user and rearrange its words in ascending order of their lengths. If
two words have the same length, maintain their original relative order.

ALGORITHM
STEP 1: Start execution.
STEP 2: Read text sentence parameters data entry input contents.
STEP 3: Split the sentence into an array of words using whitespace as a delimiter.
STEP 4: Use a stable sorting algorithm (like Bubble Sort or Insertion Sort) to sort the words array based on word lengths.
STEP 5: During sorting, compare the lengths of adjacent words: `words[j].length()` vs `words[j+1].length()`. Swap if the
left word is longer than the right word.
STEP 6: Reassemble the sorted words into a single sentence string separated by single spaces.
STEP 7: Output the rearranged sentence.
STEP 8: End execution.

CODING WITH COMMENTS

import [Link];

public class WordLengthSorter {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter sentence: ");
String inputStr = [Link]().trim();

// Remove trailing punctuation marks if present


if([Link](".") || [Link]("!")) {
inputStr = [Link](0, [Link]()-1);
}

String[] words = [Link]("\s+");


int n = [Link];

// Stable Bubble Sort sorting logic implementation


for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (words[j].length() > words[j + 1].length()) {
String temp = words[j];
words[j] = words[j + 1];
words[j + 1] = temp;
}
}
}

// Print sorted collection results configuration output


[Link]("Rearranged Sentence: ");
for (int i = 0; i < n; i++) {
[Link](words[i] + (i == n - 1 ? "" : " "));
}
[Link]();
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 inputStr String main() Raw input data sentence block framework container context.

2 words String[] main() Array holding individual extracted word string tokens.

3 n int main() Total word count tracking limit value variable framework.

OUTPUT

Enter sentence: ISC Computer Science project is easy


Rearranged Sentence: is ISC easy project Computer Science
PROGRAM 26: STACK ARRAY FRAMEWORK DATA STRUCTURE

QUESTION

Write a program to implement a Stack data structure using an array, supporting the fundamental operations of
Push, Pop, and Display.

ALGORITHM
STEP 1: Start execution.
STEP 2: Define a class `ArrayStack` with member tracking parameters: an integer array `stk[]`, a capacity integer
variable `capacity`, and a top index pointer tracking variable `top` (initialized to -1).
STEP 3: Push operation: If `top` equals `capacity - 1`, display "Stack Overflow" error. Otherwise, increment `top` and
insert the element at `stk[top]`.
STEP 4: Pop operation: If `top` equals -1, display "Stack Underflow" error. Otherwise, retrieve the element at `stk[top]`,
decrement `top`, and return the removed element.
STEP 5: Display operation: If `top` equals -1, print "Stack is Empty". Otherwise, print elements from index `top` down
to 0.
STEP 6: Terminate operational scope framework tracker system block routines.

CODING WITH COMMENTS

public class ArrayStack {


private int[] stk;
private int top;
private int capacity;

public ArrayStack(int size) {


capacity = size;
stk = new int[capacity];
top = -1;
}

public void push(int item) {


if (top == capacity - 1) {
[Link]("Error: Stack Overflow.");
return;
}
stk[++top] = item; // Increment top pointer and store value
[Link]("Pushed element: " + item);
}

public int pop() {


if (top == -1) {
[Link]("Error: Stack Underflow.");
return -1;
}
return stk[top--]; // Return value and decrement top pointer
}
public void display() {
if (top == -1) {
[Link]("Stack tracker status is currently empty.");
return;
}
[Link]("Current Stack layout (Top downwards): ");
for (int i = top; i >= 0; i--) {
[Link](stk[i] + " ");
}
[Link]();
}

public static void main(String[] args) {


ArrayStack stack = new ArrayStack(5);
[Link](10);
[Link](20);
[Link](30);
[Link]();
[Link]("Popped item value tracker out: " + [Link]());
[Link]();
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 stk int[] Class Member Array tracker container storage workspace frame block layer.

2 top int Class Member Index pointer targeting the topmost element of the stack.

3 capacity int Class Member Maximum allocated element data boundary constraint size.

OUTPUT

Pushed element: 10
Pushed element: 20
Pushed element: 30
Current Stack layout (Top downwards): 30 20 10
Popped item value tracker out: 30
Current Stack layout (Top downwards): 20 10
PROGRAM 27: LINEAR QUEUE IMPLEMENTATION DATA STRUCTURE

QUESTION

Write a program to implement a standard Linear Queue data structure using an array, supporting the fundamental
operations of Enqueue, Dequeue, and Display.

ALGORITHM
STEP 1: Start execution.
STEP 2: Define a class `SimpleQueue` with attributes: an integer array `q[]`, a `front` pointer index, a `rear` pointer
index, and a `capacity` limit. Initialize `front = 0` and `rear = -1`.
STEP 3: Enqueue operation: If `rear` equals `capacity - 1`, display "Queue Full" (Overflow). Otherwise, increment
`rear` and insert the item at `q[rear]`.
STEP 4: Dequeue operation: If `front` is greater than `rear`, display "Queue Empty" (Underflow). Otherwise, retrieve
`q[front]`, increment `front`, and return the removed item.
STEP 5: Display operation: If `front` is greater than `rear`, print "Queue Empty". Otherwise, loop and print elements
from index `front` up to index `rear`.
STEP 6: End execution.

CODING WITH COMMENTS

public class SimpleQueue {


private int[] q;
private int front, rear, capacity;

public SimpleQueue(int size) {


capacity = size;
q = new int[capacity];
front = 0;
rear = -1;
}

public void enqueue(int item) {


if (rear == capacity - 1) {
[Link]("Queue Overflow error condition encountered.");
return;
}
q[++rear] = item; // Advance rear and store item
[Link]("Enqueued item entry tracking value: " + item);
}

public int dequeue() {


if (front > rear) {
[Link]("Queue Underflow error status detected.");
return -1;
}
return q[front++]; // Return element and advance front index
}
ISC Computer Science Project

public void display() {


if (front > rear) {
[Link]("Queue is empty.");
return;
}
[Link]("Queue content data elements view layout: ");
for (int i = front; i <= rear; i++) {
[Link](q[i] + " ");
}
[Link]();
}

public static void main(String[] args) {


SimpleQueue queue = new SimpleQueue(5);
[Link](50);
[Link](60);
[Link](70);
[Link]();
[Link]("Dequeued entry value parameter: " + [Link]());
[Link]();
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 q int[] Class Member Internal array tracking container framework block.

2 front int Class Member Pointer index for extracting elements from the front of the queue.

3 rear int Class Member Pointer index for inserting elements at the end of the queue.

OUTPUT

Enqueued item entry tracking value: 50


Enqueued item entry tracking value: 60
Enqueued item entry tracking value: 70
Queue content data elements view layout: 50 60 70
Dequeued entry value parameter: 50
Queue content data elements view layout: 60 70
PROGRAM 28: DOUBLE-ENDED QUEUE (DEQUEUE) IMPLEMENTATION

QUESTION

Write a program to implement a Double-Ended Queue (DEQUEUE) data structure using an array, supporting
insertion and deletion operations from both ends (Front and Rear).

ALGORITHM
STEP 1: Start execution.
STEP 2: Define a class `Deque` with attributes: an integer array `arr[]`, a `front` pointer index, a `rear` pointer index, and
a `size` property. Initialize `front = -1` and `rear = -1`.
STEP 3: insertFront operation: If the queue is full, print "Overflow". If the queue is initially empty, set both pointers to
0. Otherwise, decrement `front` cyclically and insert the item at `arr[front]`.
STEP 4: insertRear operation: If the queue is full, print "Overflow". If the queue is initially empty, set both pointers to
0. Otherwise, increment `rear` cyclically and insert the item at `arr[rear]`.
STEP 5: deleteFront operation: If the queue is empty, print "Underflow". If only one element remains, reset both
pointers to -1. Otherwise, retrieve the element and increment `front` cyclically.
STEP 6: deleteRear operation: If the queue is empty, print "Underflow". If only one element remains, reset both
pointers to -1. Otherwise, retrieve the element and decrement `rear` cyclically.
STEP 7: End execution.

CODING WITH COMMENTS

public class Deque {


private int[] arr;
private int front, rear, size;

public Deque(int capacity) {


size = capacity;
arr = new int[size];
front = -1;
rear = -1;
}

public boolean isFull() {


return ((front == 0 && rear == size - 1) || front == rear + 1);
}

public boolean isEmpty() {


return (front == -1);
}

public void insertFront(int key) {


if (isFull()) {
[Link]("Overflow Error: Front insertion failed.");
return;
}
if (front == -1) {
front = 0; rear = 0;
} else if (front == 0) {
front = size - 1; // Circular fallback loop logic shift
} else {
front = front - 1;
}
arr[front] = key;
[Link]("Inserted at Front: " + key);
}

public void insertRear(int key) {


if (isFull()) {
[Link]("Overflow Error: Rear insertion failed.");
return;
}
if (front == -1) {
front = 0; rear = 0;
} else if (rear == size - 1) {
rear = 0; // Circular turnaround index step maps
} else {
rear = rear + 1;
}
arr[rear] = key;
[Link]("Inserted at Rear: " + key);
}

public void deleteFront() {


if (isEmpty()) {
[Link]("Underflow Error: Front deletion failed.");
return;
}
[Link]("Deleted from Front: " + arr[front]);
if (front == rear) {
front = -1; rear = -1; // Reset queue state if empty
} else if (front == size - 1) {
front = 0;
} else {
front = front + 1;
}
}

public void deleteRear() {


if (isEmpty()) {
[Link]("Underflow Error: Rear deletion failed.");
return;
}
[Link]("Deleted from Rear: " + arr[rear]);
if (front == rear) {
front = -1; rear = -1; // Reset queue state if empty
} else if (rear == 0) {
rear = size - 1;
} else {
rear = rear - 1;
}
}
public static void main(String[] args) {
Deque dq = new Deque(4);
[Link](10);
[Link](20);
[Link](5);
[Link]();
[Link]();
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 arr int[] Class Member Internal storage space array container block.

2 front / rear int Class Member Dynamic index boundary control pointer trackers.

3 size int Class Member Total size boundaries allocations limitation limit parameter.

OUTPUT

Inserted at Rear: 10
Inserted at Rear: 20
Inserted at Front: 5
Deleted from Rear: 20
Deleted from Front: 5
PROGRAM 29: SINGLY LINKED LIST CORE ARCHITECTURE

QUESTION

Write a program to implement a Singly Linked List dynamic data structure, supporting fundamental sequential
node operations such as Insertion at End and Traversal Display.

ALGORITHM
STEP 1: Start execution.
STEP 2: Define a helper class `Node` containing two member fields: an integer `data` and a reference pointer object
`next` pointing to the next node object instance.
STEP 3: Define a main class `SinglyLinkedList` containing a root tracking element node field reference named `head`.
STEP 4: insertNode operation: Create a new node instance containing the target integer data. If `head` is null, assign
this new node as the `head`. Otherwise, initialize a temporary traversal pointer variable to walk through the list until reaching
the last node (where `next` is null), then link the last node's `next` pointer to the new node.
STEP 5: printList operation: If `head` is null, display "List is Empty". Otherwise, loop through all nodes sequentially
using a temporary traversal pointer and print each node's `data` value until the pointer reaches null.
STEP 6: Terminate operational routine scope framework.

CODING WITH COMMENTS

public class SinglyLinkedList {


// Structural internal node composition component structure layout
static class Node {
int data;
Node next;

Node(int val) {
data = val;
next = null;
}
}

private Node head = null;

// Method to insert a new node at the end of the list


public void insertNode(int val) {
Node newNode = new Node(val);
if (head == null) {
head = newNode; // If list is empty, make new node the head
return;
}
Node temp = head;
while ([Link] != null) {
temp = [Link]; // Traverse to the end of the list
}
[Link] = newNode; // Link the last node to the new node
}
// Method to traverse and print the linked list
public void printList() {
if (head == null) {
[Link]("The dynamic linked collection list is empty.");
return;
}
Node temp = head;
[Link]("Linked List Chain Framework View: ");
while (temp != null) {
[Link]([Link] + " -> ");
temp = [Link];
}
[Link]("NULL");
}

public static void main(String[] args) {


SinglyLinkedList list = new SinglyLinkedList();
[Link](101);
[Link](202);
[Link](303);
[Link]();
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 head Node Class Member Root pointer referencing the first node instance in the list.

2 data int Node Class Data payload field of an individual node instance.

3 next Node Node Class Reference pointer link field targeting the next sequential node object.

OUTPUT

Linked List Chain Framework View: 101 -> 202 -> 303 -> NULL
PROGRAM 30: OBJECT-ORIENTED PRINCIPLES: INHERITANCE

QUESTION

Write a program to demonstrate Object-Oriented Programming (OOP) inheritance capabilities by creating a base
superclass `Record` and deriving a subclass `Compute` to track and process commercial consumer item inventory
data parameters.

ALGORITHM
STEP 1: Start execution.
STEP 2: Define a base parent class named `Record` with attributes: `String name` and `int cashAmount`. Implement a
constructor to initialize these tracking fields and a `display()` routine method to print them.
STEP 3: Create a subclass named `Compute` that extends the `Record` base class, introducing a new local member
variable field: `int operationalDays`.
STEP 4: In the `Compute` constructor, invoke the parent superclass constructor using the `super()` keyword parameter
token to initialize the inherited fields (`name` and `cashAmount`). Then, initialize the local subclass field `operationalDays`.
STEP 5: Implement a method in the `Compute` subclass to calculate the total due amount based on operational days and
cash value metrics.
STEP 6: Override or extend the `display()` method to print both the inherited base properties and the computed subclass
results.
STEP 7: Instantiate the `Compute` class in a `main()` entry method to execute and verify the inheritance pipeline.
STEP 8: End execution.

CODING WITH COMMENTS

// Base Superclass implementation


class Record {
protected String name;
protected int cashAmount;

public Record(String n, int c) {


name = n;
cashAmount = c;
}

public void display() {


[Link]("Client Account Holder Identity Name: " + name);
[Link]("Base standard registered tracking rate: " + cashAmount);
}
}

// Subclass inheritance extension layer framework


class Compute extends Record {
private int operationalDays;
private double totalDue;

public Compute(String n, int c, int d) {


super(n, c); // Call parent superclass constructor
operationalDays = d;
}

public void evaluateAmount() {


totalDue = cashAmount * operationalDays;
}

@Override
public void display() {
[Link](); // Invoke parent display routine
[Link]("Total tracked billing operational window days: " +
operationalDays);
[Link]("Calculated net total financial invoice dues balance: INR " +
totalDue);
}
}

// Execution initialization entry point harness


public class InheritanceProjectDemo {
public static void main(String[] args) {
Compute account = new Compute("Arunav Ray", 1500, 12);
[Link]();
[Link]();
}
}

VARIABLE DESCRIPTION

Sl No. Name Type Method Description

1 name String Record Class Protected string field tracking the account holder's name.

2 cashAmount int Record Class Protected field tracking base financial rate units.

3 operationalDays int Compute Class Private subclass field tracking total active transaction days.

4 totalDue double Compute Class Private field tracking the computed net financial dues balance.

OUTPUT

Client Account Holder Identity Name: Arunav Ray


Base standard registered tracking rate: 1500
Total tracked billing operational window days: 12
Calculated net total financial invoice dues balance: INR 18000.0

You might also like