Std10 Computer Project 23 24

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Podar International School(ISC), Pimpri.

Std 10 – Computer Application


20 Practical Assignments(Project)

Note : Write question, program and variable description for each question IN
THE SAME ORDER

1 Write a program to input an integer and pass it as parameter to a function


Niven() to check whether it is Niven number or not. A number is said to be
Niven if it is divisible by the sum of the digits of that number, example 126
and 1729.

2 Write a menu driven program using 2 functions to perform the following:


(a) Series 1 - To find the sum of the series given below i.e
2+3+5+7+9+…………….99.
(b) Series 2- to calculate the sum of the following series.

S = 1/2! + 2/3!+ 4/5! + 8/9! + 16/17! + 32/33! …. ……..n terms

3 Write a Java program to print the first 15 numbers of the Pell series. In
mathematics, the Pell numbers are an infinite sequence of integers. The
Sequence of Pell numbers starts with 0 and 1, and then each Pell number is
the sum of twice the previous Pell number and the Pell number before that.:
Thus, 70 is the companion to 29, and 70 = 2 x 29 + 12 = 58 + 12. The first few
terms of the sequences are: 0, 1, 2, 5, 12, 29, 70, 169, 408, 985, 2378, 5741,
13860…

4 Using a switch statement , write a menu driven program to find the sum of the
following series.

Series 1:
S = 1 + 2 - 3 + 4 - 5 + 6 - 7 + 8 - 9 + ……………… -15

Series 2:
S = (X+1)2+(X+2)3+(X+3)4+(X+4)5+…………… +(X+N)N+1
For an incorrect choice , an appropriate error message should be displayed.

5 Write overloaded function calculate() with following function definitions.


void calculate(int x, int y ) – to calculate the sum of all even numbers from x
till y and print the sum .
void calculate(char a,char n) – to print all vowels from variable a to n if any
void calculate(int x, int y, int z) – to print the middle number from x,y,z if
you arrange them in ascending order.

6 Define a class called Library with the following description:

Instance variables/data members:


String name : to store the name of the book
int price : to store the printed price of the book
int day : store the number of days for it which for which fine is to
be paid
double fine : to store the fine to be paid

Member methods:
void input() : to accept name of the book printed price of the book
void cal() : to calculate fine to be paid
void display() : display name of the book and fine to be paid

Write a program to compute the fine according to the given condition


Days fine
first seven days 25 paise per day
8 to 15 days 45 paise per day
16 to 30 days 60 paise per day
more than 30 days 80 paise per day

Write the main method to create an object of the class and call the above
member methods.

7 Define a class Telephone having the following description:


Instance Variables / Data Members:
int prv, pre - to store the previous and present meter reading
int call - to store the calls made (i.e. pre – prv)
String name - to store name of the customer
double amt - to store the amount
double total - to store the total amount to be paid

Member Methods:
void input ( ) - to input the previous reading, present reading and name of
the customer
void cal ( ) - to calculate the amount and total amount to be paid
void display ( ) - to display the name of the customer, calls made, amount
and total
amount to be paid in the following format:
Name Calls Made Amount Total Amount
……......... ......……..…….. ……......…….. ……........……....
Write a program to compute the monthly bill to be paid according to the
given conditions:
Calls made Rate
Upto 100 calls No Charge
For the next 100 calls 90 paise per call
For the next 200 calls 80 paise per call
More than 400 calls 70 paise per call
However every customer has to pay 180 per month as monthly rent for
availing the service.

8 Define a class Interest having the following description


Instance variables/data members
int p : to store principal amount
int r : to store rate
int t : to store time
double interest : to store the interest to be paid
double amt : to store the amount to be paid

Member methods:
void input() : stores the Principal, rate , time
void cal() : calculate the interest and amount prepaid
void display() : display the principal interest and amount to be paid
Time rate of interest
for one year 6.5%
for 2 years 7.5%
for 3 years 8.5%
for 4 years and more 9.5%
(Note : Time to be taken only in whole years)

9 An Abundant number is a number for which the sum of its proper factors is
greater than the number itself. An deficient number is a number for which
the sum of its proper factors is smaller than the number itself . Write a
program to input a number and check and print whether it is an Abundant or
deficient number or not.

Example:

Consider the number 12.


Factors of 12 = 1, 2, 3, 4, 6 Sum of factors = 1 + 2 + 3 + 4 + 6 = 16

As 16 > 12 so 12 is an Abundant number.

Consider the number 8

Factors of 8 = 1, 2, 4 Sum of factors = 1 + 2 + 4 = 7

As 7 < 8 so 8 is a deficient number

10 A Dudeney number is a positive integer that is a perfect cube such that the
sum of its digits is equal to the cube root of the number. Write a program to
input a number and check and print whether it is a Dudeney number or not.

Example:

Consider the number 512.

Sum of digits = 5 + 1 + 2 = 8
Cube root of 512 = 8

As Sum of digits = Cube root of Number hence 512 is a Dudeney number.

11 The annual examination result of 50 students In a class is tabulated in


a single dimensional array is as follows
roll number subject A subject B subject C
--------------- ----------- ------------- --------

--------------- ----------- ------------- --------

--------------- ----------- ------------- --------

write a program read the data calculate and display the following
a) Average marks obtained by each student
b) Print the roll number and average marks of the students whose average is
above 80
c) Print roll number and the average marks of the students whose average is
below 80
12 Design a class to overload a function check() as follows:
(i) void check(String str, char ch) - to find and print the frequency of a
character in a string.
Example:
Input: Output:
str=“success” number of s present is =3
ch=‘s’
(ii) void check(String s1) - to display only vowels from string s1, after
converting it to lower
Case if it is in uppercase.
Example:
Input: Output:
s1=“cOmpUter” output : o u e
(iii) void check(int num) – to check the num is palindrome or not.

13 Write a program in Java to accept a String from the user. Print all the letters
of the word in alphabetical order.

Sample Input: computer


Sample Output: cemoprtu

14 Shasha Travels Pvt. Ltd. gives the following discount to its customers:

Ticket Amount Discount

Above Rs. 70000 18%

Rs. 55001 to Rs. 70000 16%

Rs. 35001 to Rs. 55000 12%

Rs. 25001 to Rs. 35000 10%

Less than Rs. 25001 2%

Write a program to input the name and ticket amount for the customer and
calculate and return the discount amount from in the function double
calculate(int a) where a is ticket amount. Calculate net amount and display
the output in the following format for each customer:

Name Ticket Charges Discount Net Amount

15 Write a program to accept the names of 10 cities in a single dimension string


array and their STD (Subscribers Trunk Dialing) 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’.

16 The marks obtained by 50 students in a subject are tabulated as follows


Name marks
-------------- ----------
-------------- ----------
-------------- ----------

Write a program to input the names and marks of the students in the subject.
calculate and display
a) subject average marks( subject average marks = total marks / 50)
b) the highest marks in the subject and the name of the student( the
maximum marks in the subject are 100)

17 Write a program that encodes a word into Piglatin. To translate a word into a
Piglatin word, convert the word into uppercase and then place the first vowel
of the original word as the start of the new word along with the remaining
alphabets. The alphabets present before the vowel being shifted towards the
end followed by “AY”.
Sample Input (1) : London, Sample Output (1) : ONDONLAY
Sample Input (2) : Olympics, Sample Output (2) : OLYMPICSAY

18 Write a program that takes a sentence and count and print number of vowels,
consonants, numeric digits and special characters in a sentence. Assume
#,$,%,&,@ are special characters and ignore other special characters.

19 Write a program using a method Palin( ), to check whether a string is a


Palindrome or not. A Palindrome is a string that reads the same from the left to
right and vice versa.
Sample Input: MADAM, ARORA, ABBA, etc.
20 Write a program in Java to accept a word. Program should checks the string
for the presence of consecutive letters. If two letters are consecutive at any
position then the function prints "It is a magic string", otherwise it prints "It is
not a magic string".

Sample Input: computer


Sample Output: It is not a magic string
Sample Input: DELHI
Sample Output: It is a magic string

-----------------------------------------------

You might also like