0% found this document useful (0 votes)
1 views

COMPUTER PROJECT

The document is a project file created by Devansh Singh Rawat for his 12th-grade computer applications course. It includes acknowledgments, a certificate of completion, an index of various programming topics such as stacks, recursion, 2-D arrays, strings, and inheritance, along with multiple Java programming exercises and their outputs. Each section contains detailed programming questions and corresponding solutions, demonstrating the application of different programming concepts.

Uploaded by

devanshraw007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

COMPUTER PROJECT

The document is a project file created by Devansh Singh Rawat for his 12th-grade computer applications course. It includes acknowledgments, a certificate of completion, an index of various programming topics such as stacks, recursion, 2-D arrays, strings, and inheritance, along with multiple Java programming exercises and their outputs. Each section contains detailed programming questions and corresponding solutions, demonstrating the application of different programming concepts.

Uploaded by

devanshraw007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

COMPUTER APPLICATIONS

PROJECT FILE

DEVANSH SINGH
RAWAT

CLASS→12th Science

ROLL NO.→09
ACKNOWLEDGEMENT

I would like to express my


special thanks of gratitude to
my computer teacher, Mr.
Ankit Gupta, as well as our
Principal, Mrs. Seema
Sharma, who gave me the
golden opportunity to do this
wonderful project which also
helped me in doing a lot of
research and I came to know
about so many new things. I
am really thankful to them.

Secondly a would also like to


thank my parents and friends
who helped me a lot in
finalizing this project within
the limited time frame.

2
CERTIFICATE

This is to certify that


Devansh Singh Rawat of
class 12th Science of Lord
Jesus Public School,
Gurugram, has completed his
project under my supervision.

He has taken proper care and


shown utmost sincerity int
completing the project.
I certify that this project is
up to my expectation and as
in ISC guidelines.

Teacher’s Examiner’s
Signature Signature

3
INDEX

S. no. Programs Page no.

I. Programs on Stack 5

II. Programs on Recursion 19

III. Programs on 2-D array 27

IV. Programs on String 47

V. Programs on Inheritance 56

4
PROGRAMS ON

STACKS

5
Question 1. Enter a program in java enter names using stack.

6
Output→

7
Question 2. Write a menu-driven program in java→
1. Push number in stack.
2. Popping a number from stack.
3. For getting size of the stack.

8
9
Output→

10
Question 3. Write a program in java to get the peak value of the stack.

11
12
Output→

13
Question 4. Write a program in java to reverse a word using stack.

14
Output→

15
Question 5. Write a program in java to find minimum number in java using
stack.

16
17
Output→

18
PROGRAMS ON

RECURSION

19
Question 1. Design a class ArmNum to check if the given no. is Armstrong no. or
not.

20
Output→

21
Question 2. A happy no. is a no. in which eventual sum of square of digits is ‘1’.
Design a class happy to check If the no. is happy no. or not.

22
Output→

23
Question 3. The combination function C(n,k) gives the number of different k
elements subsets that can be found in given set of n elements. c=n!/k!(n-k)!
Design a class combination to implement this formula.

Output→

24
Question 4. Design a class digits to find the sum of digits of the number.

Output→

25
Question 5. Write a program to find factorial of a number.

Output→

26
PROGRAMS ON

27
Question 1. A class Shift contains a 2-d array of order (m*n) where the
maximum values of both m and n is 5. Design the class Shift to shuffle the
matrix(the first row becomes the last, the second row becomes the first and
so on.)
Class name: Shift
Data members: mat[][], m, n;
Member functions→
Shift(int mm, int nn) : constructor to initialize the data members m=mm and
n=nn.
void input(): enters the elements of the array
void cyclic(Shift P): enables the matrix of the object(P) to shift each row
upwards in a cyclic manner and store the resultant matrix in the current
object.
void display(): display the matrix elements.
Define the main() function to create an object and call the methods accordingly
to enable the task of shifting the array elements.

28
29
Output→

30
Question 2. Enter two matrixes and check whether they are equal or not .

31
Output→

32
Question 3. Enter two matrices and find their product.

33
Output→

34
35
Question 4. Write a program to create 4*4 matrix and now swap the elements
of 1st row and 4th row. Display the result.

36
Output→

37
Question 5. Write a program to perform bubble sort with 2-d array.

38
Output→

39
Question 6. Write a program to sort a 2-d array column wise.

40
Output→

41
Question 7. Write a program to enter a 2-d array and find the saddle point in
the array.

42
Output→

43
Question 8. Write a java program to store the numbers in n*m matrix in
2-d array. Find the sum of the elements in each row and each column.
Display the sum of each row and each column corresponding to the rows and
columns.

44
Output→

45
Question 9. Write a program to transpose a matrix.

Output→

46
PROGRAMS ON

47
Question 1. Write a Program in java to input the string from the user and
reverse the given string.

Output→

48
Question 2. Input a word in uppercase and check for the position of the first
occurring vowel and perform the following operation.
(i) Words that begin with a vowel are concatenated with "Y".
For example, EUROPE becomes EUROPEY.
(ii) Words that contain a vowel in-between should have the first part from
the position of the vowel till the end, followed by the part of the string from
beginning till the position of the vowel and is concatenated by "C".
For example, PROJECT becomes OJECTPRC.
(iii) Words which do not contain a vowel are concatenated with "N".
For example, SKY becomes SKYN.

Design a class Rearrange using the description of the data members and
member functions given below:
CLASS NAME: Rearrange
Data Members/instance variables→
txt: to store a word
cxt: to store the rearranged word
len: to store the length of the word
Member functions→
Rearrange (): constructor to initialize the instance
variables void readword (): to accept the word input in UPPER CASE
void convert (): converts the word into its changed form and stores it in string
cxt.
void display(): displays the original and the changed word.

Specify the class Rearrange giving the details of the constructor(), void
readword(), void convert() and void display (). Define a main() function to
create an object and call the function accordingly to enable the task.

49
50
Output→

51
Question 3. Write a Java program that accepts a student's first name, middle
name, last name and age. It then generate a password as per following
specifications :
<first and last letter of last name> <first digit of age> <first and last
letter of first name> <second digit of age> <first and last letter of middle
name>.

52
Output→

53
Question 4. Write a program in java to input the string from user and check
whether it is palindrome or not.

Output→

54
Question 5. Write a program in java to input a string from the user and remove
all the vowels.

Output→

55
PROGRAMS ON

INHERITANCE

56
Question 1. Write a program in java to add, subtract and multiply using
inheritance.

Output→

57
Question 2. Write a program to enter the name of ‘n’ salesman and print their
total sales.

58
Output→

59
Question 3. Write a program to enter fifteen integer and arrange them in
ascending order.

60
Output→

61
Question 4. Write a program to generate the first 10 numbers of the Fibonacci
series using a single dimensional array.

Output→

62
Question 5. Write a program to create an employee class by inheriting Person
class.

63
Output→

64
Question 6. Write a program to find the number having highest frequency in an
integer array. Assume that there is only one no. that has the maximum.

65
Output→

66
Question 7. Write a program to Input number in an array and count number of
prime numbers in it.

67
Output→

68
Question 8. A super class ‘number’ is defined to calculate the factorial of a
number. Define a subclass ‘series’ to find the sum of the series
S=1!+2!+3!+....+n!

CLASS NAME: number


DATA MEMBERS→
n: to store an integer number
MEMBER FUNCTIONS→
number(int nn): parameterized constructor to initialize the data member n=nn
int factorial(int a): returns the factorial
void display: displays the data member

CLASS NAME: series


DATA MEMEBERS:
sum: to store sum of the series
MEMBER FUNCTIONS:
series(....): parameterized constructor
void calsum(): calculate sum of the series
void display(): displays data members of both the classes

69
Output→

70
Question 9. A super class ‘worker’ has been defined to store the details of a
worker. Define a sub class ‘wages’ to compute the monthly wages of the
worker.
CLASS NAME: worker
Data members→
name: to store name
basic: to store basic salary;
member functions→
worker(..): to assign variable to instance variable
void display(): display workers details
CLASS NAME: WAGES
Data members→
hrs: stores the hours worked
rate: stores rate per hour
wage: stores total wage
Member functions→
Wages(....): to assign values to instance variable of both the classes
double overtime(): calculates and returns overtime amount
void display(): calculate wages using formula wage=overtime amount+basic
pay and displays it along with other details.
Use the concept of inheritance and display the workers details.

71
72
Output→

73
Question 10. Super class ‘bank’ has been defined to store the details of a
customer. Define a sub-class ‘account’ that enables transactions for the
customer with the bank. The details of both the classes are given below.
Assume that both withdrawal and addition of money in account take place
simultaneously.
CLASS NAME: bank
Data member/instance variable→
name: stores the name of the customer
accno: stores the account number
p: stores the principal amount in decimals
Member functions/methods→
Bank(…): parameterized constructor to assign values to the instance variables
void display( ): displays the details of the customer

CLASS NAME: Account


Data member/instance variable→
amt: stores the transaction amount in decimals
Member functions/methods→
Account(…): parameterized constructor to assign values to the instance
variables of both the classes
void deposit( ): accepts the amount and updates the principal as p=p + amt
void withdraw( ): accepts the amount and updates the principal as p=p-amt If
the withdrawal amount is more than the principal amount, then display the
message-“INSUFFICIENT BALANCE”.
void display( ): displays the details of the customer.
Using the concept of Inheritance, specify the class Account giving details of the
constructor(…), void deposit( ), void withdraw( ) and void display( ).

74
75
Output→

76

You might also like