17
2. Given below is a hypothetical table showing rates of Income Tax for male citizens below the
age of 65 years:
Taxable Income (TI) in Rs. Income Tax in Rs.
Does not exceed Rs. 1,60,000 Nil
Is greater than Rs.1,60,000 & less than or equal to
Rs.5,00,000
(TI – 1,60,000) x 10%
Is greater than Rs.5,00,000 & less than or equal to
Rs.8,00,000
[(TI – 5,00,000) x 20%] + 34,000
Is greater than Rs.8,00,000 [(TI – 8,00,000) x 30%] + 94,000
Write a program to input age, gender (male or female) and Taxable Income of a person.
If the age is more than 65 or the gender in female, display “wrong category”.
If the age is less than or equal to 65 years and the gender is male, compute and display the
Income Tax payable as per the table given above.
3. Write a program to accept a string. Convert the string to uppercase. Count and output the
number of double letter sequences that exist in the string.
4. Design a class to overload a function polygon () as follows:
i.Void polygon (int n, char ch)-with one integer argument and one character type
argument that draws a filled square of side n using the
character stored in ch.
ii.void polygon(int x, int y) -with two integer argument that draws a filled rectangle of
length x and breadth y, using the symbol ‘@’.
iii.void polygon () - with no argument that draws a filled triangle shown below
*
* *
* * *
5. Using switch case statement, write a menu driven program to:
i.Generate and display the first 10 terms of the Fibonacci series starting from 0.
ii.Find the sum of the digits of an integer that is input
For an incorrect choice an appropriate error message should be displayed.
6. Write a program to accept the names of 10 cities in a single dimension string array and their
STD codes in another single dimension integer array. Search for a name of a city input by the
user in the list. If found display “search successful” and print the name of the city along with
its STD code, or else display the message “Search Unsuccessful, No such city in the list”.
ICSE Question [2013]
1. Define a class named FruitJuice with following description:
Instance variable/data Members:
int product_code :Store the product code number
String flaour :Store the flaour of the juice (E.g. Orange,apple etc.)
String pack_type :Store the type of packaging (Eg. Tetra Pack, PET bottle etc.)
int pack_size :Store packagr size (Eg. 200ml, 400ml etc)
int product_price :Store the price of the product
Member Methods:
i. FruitJuice() :Default constructor to initialize integer data members to 0 and
String data members to “”.
ii. void input() :To input and store the product_code, flavour,pack_type,
pack_size and product_price.
iii. void discount() :to reduce the product_price by 10.
iv. void display() :to display the product code, flavour, pack size and product price.
2. The international Standard Book Number (ISBN) is a unique numeric book identifier which is
printed on every book. The ISBN is based upon a 10 digit code. The ISBN is legal if:
1*digit1 + 2*digit2 +3*digit3 + 4*digit4 + 5*digit5 + 6*digit6 +7*digit7 + 8*digit8 + 9*digit9 +
10*digit10 is divisible by 11.
Example: for a ISBN 1401601499
1*1+ 2*4 +3*0 + 4*1 + 5*6 + 6*0 +7*1 + 8*4 + 9*9 + 10*9=253 which is divisible by 11.
Write a program to:
(i) input the ISBN code as 10 digit integer.
(ii) If ISBN is not 10 digit integer, output the message, “Illegal ISBN and terminate the
program.
(iii) If the number is 10 digit do the calculation as shown above.
(iv) If sum is divisible by 11, output message, “Legal ISBN”. If the sum is not divisible by 11
output the message “Illegal ISBN”.