## ICSE Computer Project, 2011

** **

**PROJECT WORK**

ICSE COMPUTER APPLICATIONS

**2011 – 12**

** ———————————————————————————————————————————————————————-**

**Rules & Regulations**

- Programs are to be written in Java with Blue-J as the environment.
- You are expected to submit the complete project work (incomplete work will be marked ZERO).
- You need to furnish the following as your project contents…

- Cover Page
- The Program Code
- 2 sets of sample input and output
- Variable Description for each program

- All projects must be printed in B/W or colored printouts.
- Avoid usage of unwanted illustrations and decorations.
- The front page must contain your
**name**,**class**,**section**and**roll number**, along with**index no.**if you receive the number before the project submission date. - All the pages must be numbered.
- You are supposed to submit your work in white Transparent Channel Files.
- Date of submission on or before
**30**^{th}November 20**11.**

**———————————————————————————————————————————————————————-**

**PROJECT QUESTIONS**

**5 Programs on Sequential Structure**

- WAP to swap the values stored in two variables (using a third variable)
- WAP to swap the values stored in two variables (without using a third variable)
- Find out the total equivalent resistance in a circuit in which the 2 resistors are connected in parallel and series

- Parallel = (R
_{1}*R_{2}) / (R_{1}+R_{2}) - Series = R
_{1}+ R_{2}

———————————————————————————————————————————————————————-

**5 Programs on Selection Structure**

- WAP to input three nos. and print the 1
^{st}largest, 2^{nd}largest and the 3^{rd}largest of them do not use arrays and sorting.

- WAP to enter the co-efficient of Quadratic Equation ax
^{2}+bx+c=0 and find out the roots, Roots of a Quadratic Equation and mention whether the Roots are Real, Equal or Imaginary

- JSEB charges their consumer according to the tariff chart given below,

**Units Consumed Charges**

- Up to 50 units Free
- 51 – 100 0.75p
- 101 – 250 1.25p
- 252 – 500 2.50p
- Above 500 3.00p

WAP in java to input the units consumed and display the electricity bill calculated as per following. A surcharge of Rs. 75.00 is levied if the units consumed exceeds 250. A fixed rental of Rs. 180.00 is charged to all the consumers. Over an above a Service Tax of 12 ½ % is add-on to the above and an Edu. Cess of 2% on the Service Tax is charges as extra. Calculate the Bill amount if on the whole a rebate (discount) of 4% is allowed.

- A cab driver charges Rs. 15.00 on the first meter (km). he charges an extra of Rs. 22.00 on the next 5 kms. Anything beyond that is charged at Rs. 2.50 per km. WAP to input the distance covered and calculate the cab charges.

- Write a menu driven program to input/assign/store 2 numbers and perform the following mathematical operations on the two variables as given below in the menu…

- Addition (+)
- Subtraction (-)
- Multiplication (x)
- Division (/)
- Modulus (%)
- Power (x
^{y})

———————————————————————————————————————————————————————-

**10 Programs on Iterative Structure (on Numbers)**

- Input any number and check if it is a Special (
**Krishnamurthy**) number or not. (Hint: 145 = 1! + 4! + 5!)

- Input any number and check if it is an Armstrong (
**Narcissistic**) number or not. (Hint: 153 = 13 + 53 + 33)

- Input any number and check if it is a
**Perfect**number or not. (Hint: 6 = 1 + 2 + 3, sum of factors excluding itself)

- Input any number and check if it is a
**Palindrome**or not. (Hint: 121 = 121)

- WAP to input two numbers and print the
**HCF**(GCD) and**LCM**of the two numbers.

- WAP to check whether a number entered by the user is a
**Automorphic**number. E.g. 25 is an Automorphic number because 25^{2}= 625 in which the number of digits in the original number (i.e. 25) before squaring is identical to that many number of digits from the LHS of the squared number (i.e. 625).

- WAP to check whether a number entered by the user is an
**Evil**number or not. An Evil number is one whose Binary counterpart has even number of ones. E.g. 10, as the binary of 10 is 1010 which has 2 ones (hence Evil), whereas numbers that has Odd number of 1’s are called**Odious**numbers

- WAP to generate the
**Tribonacci**Series. E.g. 0, 1, 1, 2, 4, 7, 13… A Tribonacci series is one whose every 4th term is the sum of 1st, 2nd and 3rd terms.

- WAP to check whether two numbers entered by the user belong to the set of
**Amicable**Pair or not. Two numbers are said to be Amicable Pair if the sum of factors of the 1st excluding the number is equal to the 2nd number and the sum of factors of the 2nd number excluding itself is equal to the 1st E.g. 220 and 284

- Write a program to check whether the number entered by the user is a UNIQUE INTEGER or not. A
**UNIQUE INTEGER**is one that has no repetition of digits. i.e. all the digits are distinct and appears only once. For e.g. 1234, 65234 etc… whereas digits like 1000, 65536, 121 are not.

———————————————————————————————————————————————————————-

**5 Programs on Single Dimensional Arrays**

- Input 10 nos. in an array and search a given number from within that array using Linear Search technique, and display whether found or not along with its position.

- Input 10 nos. in an array and search a given number from within that array using Binary Search technique.

- Sort an array of 10 elements in Ascending / Descending Order using Bubble Sort technique.

- Sort an array of 10 elements in Ascending / Descending Order using Selection Sort technique.

- Store 5 nos. in array A[ ] and 5 nos. in array B[ ] and merge them into array C [ ]

———————————————————————————————————————————————————————-

**5 Programs on Functions**

- Create overloaded methods named void calc_volume ( ), that has been overloaded to perform the following functions

- Volume of Sphere
- Volume of Cylinder
- Volume of Cone

Write a menu driven program in Java to display the above 3 menus and execute the overloaded methods and display the volume in the respective functions,

- calc_volume (double) for sphere,
- calc_volume (double, double) for cylinder and
- calc_volume (float, float) for cone.

- Write a program to create a class which will have the following functions:

int NumFun() : to create a single dimensional array of size 50 integers and return the smallest integer

int NumFun(int) : to calculate and return sum of factors, excluding the number, of the number returned by the above function

int NumFun(int, int) : to check whether the two results returned by the above functions are same or not and accordingly display “perfect” or “non-perfect”

void main() : to execute all the above functions accordingly, using the concept of function overloading.

- Define a class with the following specifications:

int Armstr(int) : to check a number and return 1 if the number is Armstrong otherwise return 0.

void prime(int, int ) : to display all prime numbers within the range entered by the user.

void main : to input number and display the message depending upon the value returned by Armstr(int) and to input range required for prime(int, int).

- A class
**Myseries**is declared to find the sum of the following series

sum = 1*y^{2}/1! + 2*y^{4}/2! + 3*y^{6}/3! + 4*y^{8}/4! … **till 10 terms**

**Data** **members**

int y : integer number

long sum : integer to store sum

** **

**Member** **Functions**

void getnum( ) : to accept the integer ‘y’

void getseries( ) : to find the sum of elements of the series

long getpower(int, int) : to calculate ‘y’ to the power ‘x’

long getfact(int) : to calculate the factorial of the denominator

void display( ) : to display finally the sum of the series

- Write a function named
**int sort_digit (int)**in Java to pass an integer number as argument that might contain any number of digits, and sort each individual digits of the number in ascending order and return the same, (without implementing arrays).

e.g Sample Input: 4987

Sample Output: 4789

Sample Input: 1205

Sample Output: 0125

———————————————————————————————————————————————————————-

**10 Programs on Strings**

- Input a sentence and display the total no. of letters, digits, uppercase letters, lowercase letters, spaces, special characters, vowels and consonants are present in it.

- Input the complete name of a person and display the initials, e.g. Mohandas Karamchand Gandhi as MKG

- Input a sentence and reverse each word without reversing the sequence of the words. E.g. COMPUTER IS FUN, as RETUPMOC SI NUF

- Input a sentence and convert each word into a Piglatin. E.g. COMPUTER IS FUN becomes OMPUTERCAY ISAY UNFAY

- Input a sentence and display only the Palindrome words, like NITIN ARORA PLAYS FOOTBALL, gives NITIN, ARORA

- Input names of ten capital cities and arrange them in Lexicographic order and redisplay them.

- Input a sentence in any random case and capitalize the first and last letter of each word and convert the rest to lower case

- Input a word and generate the following
**pattern**

Input: MATHS

Output:

M

MA

MAT

MATH

MATHS

- Write a program in Java to accept a line of text from the user and create a new word formed out of the first letter of each word. After creating the new word reverse it and check whether it is a Palindrome or not.

E.g. If the user enters: Mangoes Are Delivered After Midnight

Output: MADAM

Reverse: MADAM

Yes, it is a Palindrome

E.g. If the user enters: A Brick In The Wall

Output: ABITW

Reverse: WTIBA

No, it is not a Palindrome

- Input a string along with an encoding factor and write a cryptography program code to encrypt the data. E.g. Input word is “APPLE” and Encoding factor is 3 then each letter gets encoded by a factor of 3 by adding it to its ASCII equivalent resulting in “DSSOH”

*************

category Sequential Structure :

prog no 3….

is that a menu-driven prog..???

no…

just take inputs for R1 and R2 and display the equivalent values in series and parallel

A cab driver charges Rs. 15.00 on the first meter (km). he charges an extra of Rs. 22.00 on the next 5 kms. Anything beyond that is charged at Rs. 2.50 per km. WAP to input the distance covered and calculate the cab charges.

isme if user input 2 kms then shoul the output be (15+22) or will it be ist km ka 15 and the another 1 km ke hisab se (15+(22/5))

no it is 15 + 22

category Sequential Structure :

prog no 3….

is that a menu-driven prog..???

Iterative 6th Question

is it 25^5 because 252=625 does’nt make sense and also is it RHS in place of LHS

@shivanand

Automorphic nos.: If the square of the number contains the number as the last digits.

for example, 25 is an automorphic no. as its square is 625 and 25 is present as the last two digits.

progs on string Qno-6 what is lexicographic order

Iterative Structure:

prog no 8.

whats the limit of d series !!

in progs on arrays Qno. 5 what does merge mean????

do we add the elements of a and b??

Sir, is there a chance of scoring a full marks in this project?? if all the programs work right, where can one lose marks??

Iterative Structure:

prog no 8.

whats the limit of d series !!

Is variable description now required ? (as of 12/11/2011 21:20 IST)

tribonacci series….facing problems please help!!!

please tell me how to print the different combinations of a 3 digit no. in java….

Q. A teacher wants to keep the names and their total marks obtained in the final examination of her class having 40 students. Write a program in Java to store all the names and the total marks in two different Single Dimensional Array & display all the names of the students according to the rank obtained in the final examination, keeping the 1st rank at the top and so on.

import java.io.*;

class Rank

{

public static void main() throws IOException

{

InputStreamReader x= new InputStreamReader(System.in);

BufferedReader y= new BufferedReader(x);

int marks[]=new int[40];

String names[]=new String[40];

int i,j,temp;

String str;

System.out.println(“Enter the names of the students and marks obtained for 40 in a class”);

for(i=0;i<40;i++)

{

names[i]=y.readLine();

marks[i]=Integer.parseInt(y.readLine());

}

for(i=0;i<40-1;i++) // bubble sort begins

{

for(j=0;jmarks[j+1])

{

temp=marks[j]; //swapping marks

marks[j]=marks[j+1];

marks[j+1]=temp;

str=names[j]; //swapping names

names[j]=names[j+1];

names[j+1]=str;

}

}

} //bubble sort ends

System.out.println(“Rank \t\t Names \t\t Marks”);

for(i=0;i<40;i++)

{

System.out.println((i+1)+"\t\t"+names[i]+"\t\t"+marks[i]);

}

}

}