0% found this document useful (0 votes)
636 views4 pages

Computer Holiday Homework Class 10 ICSE 2023 - 24

The document contains 21 programming problems covering topics like arrays, classes, functions, conditionals, loops, strings, and mathematical concepts like factors, primes, and time calculations. The problems include writing programs to add lengths in feet and inches, convert characters to uppercase/lowercase and print the next/previous characters, calculate discounts and bills based on purchase amounts, find factors of numbers, calculate time sums, and more. Classes and functions are defined to perform calculations, take inputs, and print outputs for the various problems.
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)
636 views4 pages

Computer Holiday Homework Class 10 ICSE 2023 - 24

The document contains 21 programming problems covering topics like arrays, classes, functions, conditionals, loops, strings, and mathematical concepts like factors, primes, and time calculations. The problems include writing programs to add lengths in feet and inches, convert characters to uppercase/lowercase and print the next/previous characters, calculate discounts and bills based on purchase amounts, find factors of numbers, calculate time sums, and more. Classes and functions are defined to perform calculations, take inputs, and print outputs for the various problems.
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/ 4

St. George’s College, 3 Garden Road, Baluganj, Agra Cantt.

Programming Assignment
Class – X (Session 2023 – 24)
1. The length in feet and inches are added as:
Let Length1 = 8 feet 7 inch
Let Length2 = 7 feet 10 inch
Sum of Length1 and Length2 = 16 feet 5 inch (where 12 inch = 1feet)
2. Write a program to input a character check if it is an alphabet then convert it into
uppercase form, if lowercase. Print the next five characters in circular alphabetical list
including the modified character if it is a consonant. Print the previous five characters in
circular alphabetical list including the modified character if it is a vowel.
Example: Input: w Output: WXYZA
Input: E Output: EDCBA
3. Write a menu driven program to display two options “Print day of week” OR “Name of the
month”. Your program should then ask for day number or month number on the basis of
the choice selected and the program should print either day of week or name of the month.
4. An electronic shop has announced the seasonal discounts on the purchase of certain
items.
Purchase amount in Rs. Discount on Laptop Discount on Desktop
0 – 25000 0.0% 5.0%
above 25000 – 57000 5.0% 7.5%
above 57000 – 100000 7.5% 10.0%
More than 100000 10.0% 15.0%
Write a program based on above criteria, to input name of customer, address of customer,
amount of purchase and type of purchase (L for Laptop and D for Desktop). Calculate and
print the net amount to be paid by the customer along with his/her name and address.
5. Write a program to enter 3 numbers in 3 different variables. Print numbers in ascending
or descending order as choice of user.
6. A Hotel has following special rates for stay depending upon number of days:
Number of days Rate per day
First 3 days Rs. 350
for next 3 days Rs. 300
for next 3 days Rs. 275
Any day beyond 9 days Rs. 225
Write a program to input name of person, number of days stayed, room number allotted,
check-in date and check-out date. Calculate checkout bill amount. Print name of person,
number of days stayed, room number, check-in date, check-out date and total amount to
be paid by the person.
7. A number is said to be prime if the number has only two factors i.e. the number is divisible
by 1 and itself only. Write a program to print Fibonacci terms which are prime in nature
upto n terms. ‘n’ is the limit of Fibonacci series which is given by the user as input.

1
8. SELF BANK HOME FINANCE revised its rate of interest for Public Deposits as:
Years Cumulative Interest Scheme Annual Income Scheme
(Compounded Annually)
1 ----- 10%
2 ----- 10.5%
3 11.5% 11%
4 11.75% 12%
5 12% 12.25%
Deposit under the cumulative scheme is accepted for a period between 3 to 5 years
Write a program to find the:
a. amount (A) due for sum (P) invested under the cumulative option scheme, by using
the formula A = P x (1+0.01xR)T
b. Interest (I) for each year, under the annual interest scheme, using the formula
I=0.01xPxR
The program should continue as long as the user wants.
9. Write a program to print those integers between 1 to n which are divisible by m. Also print
whether the number is that is divisible by m is even or odd. Input n as last limit and m as
divisor.
10. Input N and M as start and end limits. Print the factorial of all integers between N and M
if N<M, otherwise print a message “factorials not possible”.
11. Write a program to accept a choice (ch), limit of series (n) & base (x) and print sum of the
following series as per user’s choice.
if choice =1: sum = -1 + x2 /2! – 2x4 /4! + 3x6 /6! – 4x8 /8! ... nx2*n /(2*n)!
if choice =2: sum = (1*2 3) + (2*3 4) + (3*45) + (4*5 6).... 𝑛 𝑡𝑒𝑟𝑚𝑠
if choice =3: sum = 2x/4! – 4x2/8! + 6x3/12! – 8x4/16! + 10x5/20! – .... 𝑛 𝑡𝑒𝑟𝑚𝑠
if choice =4: sum = 1 + (x+2)/2! + (2x+3)/3! + (3x+4)/4! + .... 𝑛 𝑡𝑒𝑟𝑚𝑠
12. Write a program to print all Pythagorean triplet between1 to 100. A Pythagorean triplet is
the set of three consecutive numbers such that sum of square of first two numbers is equal
to the square of third number.
13. Create a function void finder (int x, int y): to find the GCD of x and y using Euclid’s method
(remainder method). Write a main method to input two numbers & print GCD.
Euclid’s Method.
Step 1: Decide the greater from two numbers.
Step 2: Divide the greater number by smaller number, if remainder is zero, print divisor
(smaller number) as GCD, otherwise
Step 3: Take divisor as number and remainder as divisor, and repeat Steps 2 and 3.
14. Define a class Number with three methods:
int maxDigit(long num): to find and return greatest digit of number stored in num.
int minDigit(long num): to find and return smallest digit of number stored in num.
void freq(long num): to print frequency of each digit of number stored in num.
15. Define a function void findVowel(char ch) that takes a character in ch and find its nearest
vowel if ch is not a vowel. Print original value of ch and its nearest vowel. Your program
should display and error message if original value of ch is not within A-Z or a-z.
16. Define a class Check to overload method primes()
int primes(int num) : returns -1 if number is composite or returns 1 if number is prime.
2
void primes(long num): print only prime digits of num.
void primes(int n, int m): To print whether number stored in n and m are prime or not if yes
then print whether n and m are Twin-Primes or not otherwise print suitable message. (Two
numbers are said to be Twin-Primes if both the numbers are prime & their difference is 2).
17. Design a program to overload a function triangle as follow to print three different patterns:
void triangle ( int n, char ch)
1*1
12*21
123*321
1234*4321
12345*54321

void triangle ( int n, char c1, char c2 )


@987654321&
$2345678@
@76543&
&456@
@5&

void triangle ( int n)


13579
35792
57924
79246
92468
246810
18. Create a class SalaryCalculation as given:
class Name : SalaryCalculation
Data Members/Variables : name, basicPay, specialAlw, conveyanceAlw, gross, pf,
netSalary, annualSal.
Member Functions of class:
void giveValues( ) : A function to enter name of employee, basicPay of
employee of your choice and assign Rs. 5000 to
conveyanceAlw
void salaryCal( ) : To Calculate other allowances and salaries as given
specialAlw = 25% of basicPay.
gross = basicPay + specialAlw + conveyanceAlw
pf = 8.33% of basicPay
netSalary = gross – pf;
annualSal = netSalary of 12 months.
void display( ) : To print Data Members of class with suitable headings.
Write a main function to create the object of class SalaryCalculation & call methods.
19. Create a class Stock as given
class name : Stock
Data Members/variables : pname, qty, price, total, discount, netPrice
Member functions/methods:
Stock(String n, int q, double p) : a parameterised constructor to assign values.
3
void calculation() : to calculate total cost, discount as 25% on total cost if total cost is
more than 15000 Rs. otherwise no discount. Also find netPrice to be
paid excluding discount.
void printAmount() : to display product name, price, quantity, total cost, discount and
netPrice to be paid.
Write a main function to input name of product, unit price of product and quantity and by
using above class and functions. Print details of the product.
20. A class Clock has following members:
Instance Variables/Data Members : h1,h2,m1,m2
Instance Methods/Member Functions:
public Clock(int h, int m, int hh, int mm):Parameterised constructor to initialised Instance
variables.
public void showTime( ) : To display two timings in hours and minutes.
public void addTime( ) : To add values of two timings and display addition
of timings.
Define a main function to input two timings. Print the given timings and output the sum of
time by invoking suitable functions.
21. Define a class Array to accept list of n integers in a single subscripted variable. Now
perform the following:
a. Count and print even numbers and odd numbers.
b. Sum of all the elements of the array divisible by 5.
c. Factorials of single digit integer less than or equal to 7.
22. Write a program to create a single dimensional array of size n real numbers. Print the
rounded value of those real numbers whose fractional part is greater than or equal to 5.
23. Write a program to create a single dimensional array of n integers. Print only those
integers from the array which are palindrome numbers.
24. Accept an array containing names, which is already sorted in reverse alphabetical order.
Write a program to search a name of user’s choice in the list using binary search technique.
25. Write a program to input a single dimensional array of 10 Integers arrange first 5 integers
in descending order and next 5 integers in ascending order using bubble sort method. Print
unsorted and sorted array. Do not use any other array.
26. Write a program to enter a sentence. Print frequency of each word present in the sentence
also print the word separately which is having maximum frequency.
27. Write a program to input String (may be in the form of sentence also) text. Convert it in to
capitals modify the String by adding 2 each character present in the String. Print the original
and modified Strings.
Example: Input : Adc MOP Boy Girl
Output : CFE OQR DQA IKTN
28. Write a program to initialize an array of 5 names and initialise another array with their
respective telephone numbers. Search for a name input by the user in the list. If found,
display “Search Successful” and print the name along with the telephone number, otherwise
display “Search Unsuccessful. Name not enlisted”.
29. Write a program to input a sentence. Print the sentence along with longest and smallest
word.
30. Write a program to create class ArrangeLetters and a method arrange ( ) with a String
parameter. Convert the word into capital, arrange each letter of the word in Alphabetical
order. Print the word before and after arranging letters in A – Z order.
4

You might also like