0% found this document useful (0 votes)
92 views7 pages

Grade X CA Lab Manual Program List 24-25

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)
92 views7 pages

Grade X CA Lab Manual Program List 24-25

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
You are on page 1/ 7

Grade X CA Lab manual

Lab manual program no 1


Define a class Discount having the following description:
Class name : Discount
Data Members Purpose
int cost to store the price of an article
String name to store the customer's name
double dc to store the discount
double amt to store the amount to be paid

Member methods Purpose


void input() Stores the cost of the article and name of customer
void cal() Calculates the discount and amount to be paid
void display() Displays the name of the customer, cost, discount and amount to be
paid
Write a program to compute the discount according to the given conditions and display the
output as per the given format.

List Price Rate of discount


Up to ₹5,000 No discount
From ₹5,001 to ₹10,000 10% on the list price
From ₹10,001 to ₹15,000 1 5% on the list price
Above ₹15,000 20% on the list price
Output:
Name of the customer Discount Amount to be paid
.................... ........ .................
.................... ........ .................
Write a main method to create an object of the class and call the above member methods.

Lab manual program no 2


Define a class called BookFair with the following description:

Data Members Purpose


String Bname stores the name of the book
double price stores the price of the book

Member Methods Purpose


BookFair( ) Constructor to initialize data members
void input( ) To input and store the name and price of the book
void calculate( ) To calculate the price after discount. Discount
is calculated as per the table given below
void display( ) To display the name and price of the book
after discount
Price Discount
Less than or equal to ₹1000 2% of price
More than ₹1000 and less than or equal to ₹3000 10% of price
More than ₹3000 15% of price
Write a main method to create an object of the class and call the above member methods.

Lab manual program no 3:


Write a Menu Driven program to find the given below numbers are:
1. Find and display Sum of digits
2. Palindrome - A number is a Palindrome which when reads in
reverse order is same as in the right order.
Sample Input: 242
Sample Output: A Palindrome number
Sample Input: 467
Sample Output: Not a Palindrome number
3. Abundant/Deficient/Perfect –
If the sum of the factors excluding itself is equal to that number
it is perfect, if greater than that number it is abundant and
if less than that number it is deficient number.
4. Spy number - A spy number is a spy if the sum of its digits equals
the product of its digits.

Lab manual program no 4:


Write a menu driven class to accept a number from the user and check whether it is a
Perfect number, Harshad number, Happy number or not
(A) Perfect number-
A number is called Perfect if it is equal to the sum of its factors
other than the number itself.
Example: 6 = 1+2+3
(B) Harshad(Niven) number-
A number is said to be Harshad if it is divisible by the sum of the digits of that
number.
Example: 126 and 1729.
(C) Happy number-
If you iterate the process of summing the squares of the decimal digits of a number
and if this process terminates in 1, then the original number is called a Happy
number.
Example: 7 =>(7^2) = 49
=>(42 + 92) = 97
=>(92 + 72) = 130
=>(12 + 32 + 0^2) = 10
=>(1^2 + 0^2) = 1

Lab manual program no 5:


Using overloading technique, write methods to:
• accept two int type data as parameters and return their sum.
• accept three int type data as parameters and return their sum.
• accept two double type data as parameter and return their sum.
• accept a double type and int type as parameter and return their sum.
main() function is optional

Lab manual program no 6:


Write a menu driven program to calculate using method overloading:
'c'. Perimeter of circle=2*pi*r
void perimeter(int r)

'r'. Perimeter of rectangle=2*(l+b)


void perimeter(int l, int b)

't'. Perimeter of triangle=(s1+s2+s3)


void perimeter(int s1, int s2, int s3)

Enter 'c' to calculate the perimeter of the circle,’t’ to calculate perimeter of the triangle and
'r' to calculate perimeter of the rectangle.

Lab manual program no 7:


Create a function which accepts an integer as parameter and return true if it is a prime
number otherwise return false.
Create another function which accepts an integer as parameter and return true if it is
palindrome otherwise return false.
In the main() method display all three digit pal-prime number. Palprime numbers are such
numbers which are both palindrome as well as prime numbers.
For example, 101,131,151,181,191,313,353,373,383,727,757,787,797,919 and 929 are all
three digit pal-prime numbers.
Lab manual program no 8:
Design a class to overload a function compute() as follows :
(i) void compute(int, char): to compute the square of the integer argument if the given
character argument is 's' otherwise find its cube
(ii) void compute(double,char): to compute volume of a cube if the given character
argument is 'v' otherwise find its diagonal.
(iii) void compute(int,int,char): to compute area of a rectangle if the given character
argument is 'a' otherwise finds perimeter .
Volume of cube = side 3
Area of rectangle = length * breadth
Diagonal of cube = a√3
Perimeter of rectangle = 2 * (length + breadth)

Lab manual program no 9:


Using the switch case write a menu diven program to:
1 - Generate Fibonacci series til n term
2 - Find special number : In which the sum of factorial of each digit = number it self
3 - Generate pattern
15 14 13 12 11
10 9 8 7
6 5 4
3 2
1
Lab manual program no 10 :
(a) To display the pattern given below:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1

(b) To display the first ten terms of the series:


0, 01, 012, 0123, 01234, 012345,……….., 0123456789

(c) To display the prime numbers between 1 to n

Lab manual program no 11:


Write a java program to accept 10 unsorted integers in any array sort numbers using bubble
sort.
Accept searching element from the user search it using binary search if found display
"Search Successful" else "Search Unsuccessful"
Lab manual program no 12:
Write a program to input and sort the weight of ten people.
Sort and display them in descending order using the selection sort technique.

Lab manual program no 13:


Write a program to initialize & store 6 number of state name and its capital and then input a
state name and print its capital if it is in the list otherwise print the appropriate message
using linear search.
String st[] = {"Andhra Pradesh","Assam","Bihar","Chhattisgarh","Goa","Gujrat"};
String cap[] = {"Hyderabad","Dispur","Patna","Raipur","Panaji","Gandhinagar"};
Example:
Maharastra
State name not found
Andhra Pradesh
The State name : Andhra Pradesh, Capital : Hyderabad

Lab manual program no 14:


Data members — int array m[][] with 3 rows and 3 columns
Member functions:
void getdata() — to accept the numbers in the array
void rowsum() — to find and print the sum of the numbers of each row
void colsum() — to find and print the sum of numbers of each column
void primeDiagonalSum() — to find and print the primary diagonal sum of matrix
void secondaryDiagonalSum() — to find and print the secondary diagonal sum of matrix
void transpose() — to find and print the transpose of matrix
Use a main function to create an object and call member methods of the class.

Lab manual program no 15:


Write a program to accept numbers in a 4×4 matrix, then print the all prime numbers
present in the matrix with array Index value.
SAMPLE DATA:
INPUT:
16 15 1 2
6 4 10 14
9 8 12 5
3 7 11 13
OUTPUT:
PRIME ROW INDEX COLUMN INDEX
2 0 3
3 3 0
5 2 3
7 3 1
11 3 2
13 3 3

Lab manual program no. 16:


Define a class to accept a string and convert it into uppercase. Count and display the number
of vowels in it.
Input:
education
Output:
EDUCATION
Number of vowels: 5

Lab manual program no 17:


Design a class to overload a function check( ) as follows:

void check (String str , char ch ) — to find and print the frequency of a character in a string.
Example:
Input:
str = "success"
ch = 's'
Output:
number of s present is = 3

void check(String s1) — to display only vowels from string s1, after converting it to lower
case.
Example:
Input:
s1 ="computer"
Output : o u e

void check(String s, char ch1, char ch2) with one string argument and two character
arguments that replaces the character argument ch1 with the character argument ch2 in the
given String s and prints the new string.
Example:
Input: value of s = "TECHNALAGY"
ch1 = 'A'
ch2 = 'O'
Output: "TECHNOLOGY"
Lab manual program no 18:
Define a class to accept a string and convert the same to uppercase, create and display the
new string by replacing each vowel by immediate next character and every consonant by the
previous character. The other characters remain the same.
Example: Input: #IMAGINATION@2024
Output: #JLBFJMBSJPM@2024

Lab manual program no 19:


Write a program in Java to enter a sentence. Frame a word by joining all the first characters
of each word of the sentence. Display the word.
Sample Input: Vital Information Resource Under Seize
Sample Output: VIRUS

Lab manual program no 20:


Write a program to input a sentence and arrange each word of the string in alphabetical
order.

You might also like