0% found this document useful (0 votes)
7 views

Computer Project

This document contains a computer application practical file for a student named Rushil Mishra in 10th grade. It includes 8 assignments on topics like Floyd's triangle, Fibonacci series, ISBN codes, and more. Each assignment contains the problem statement, an explanation of the approach, sample code with inputs and outputs, and a variable description table.

Uploaded by

rushilmishra7
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Computer Project

This document contains a computer application practical file for a student named Rushil Mishra in 10th grade. It includes 8 assignments on topics like Floyd's triangle, Fibonacci series, ISBN codes, and more. Each assignment contains the problem statement, an explanation of the approach, sample code with inputs and outputs, and a variable description table.

Uploaded by

rushilmishra7
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Computer

Application

Name: Rushil Mishra

th
Class: 10 B
Session: 2021-22
1
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Index
CONTENT PAGE
NUMBER
Assignment 1 4
Assignment 2 9
Assignment 3 13
Assignment 4 17
Assignment 5 21
Assignment 6 27
Assignment 7 32
Assignment 8 39
Bibiliography 43

2
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Acknowledgement

I would like to express my special thanks


and gratitude to our Principal Dr. Anita
Pauline Dey and the subject Teacher Mr.
Chandan Seth who gave us the
opportunity and fruitful guidance to do
this project on Java Programming.
Secondly I would also like to thank my
parents who helped me a lot in finalising
this project. By doing this project I got
enriched with many information which
can help in future.

3
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Assignment-1
Using the switch statement, write a menu
driven program for the following:
(i)To print the Floyd’s triangle [Given below]
1
23
456
7 8 9 10
11 12 13 14 15
(ii)To display the following pattern based on
value of n. For example if n=5 then print,
54321
4321
321
21
1

4
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Synopsis
For this assignment, nested for loop is
going to be used. First, input is taken
from Scanner class. Then using switch
case menu is created, and in first case,
by taking the number of rows as input,
FOR LOOP is nested and a new
variable with the value 1 is printed and
its value is increased by 1.
In the second case, first n is taken as
input, then using FOR LOOP, the given
triangle is displayed.

Source Code
import java.util.*;

5
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
class Sample

public static void main(String args[])

Scanner sc = new Scanner(System.in);

System.out.println("Enter 1 for Floyd's Triangle. ");

System.out.println("Enter 2 for Pattern Printing.");

int n= sc.nextInt();

switch(n)

case(1):

System.out.println("Enter the number of rows:");

int r = sc.nextInt();

int i,j,k=1;

for(i=1;i<=r;i++)

for(j=1;j<=i;j++)

System.out.print(k+" ");

k=k+1;

System.out.println();

break;

case(2):

System.out.println("Enter the value of n:");

int in= sc.nextInt();

int a,b;

for(a=in;a>=1;a--)

for(b=a;b>=1;b--)

System.out.print(b+" ");

6
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
System.out.println();

break;

default:

System.out.println("Error");

break;

Variable Description Table


Variable Data Type Purpose
a Int For row
b Int For column
i Int For row
j Int For column

k Int Printing value

r Int Input row


in Int Value of n
n Int Input option

Input & Output Window

7
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Assignment-2
8
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Write a program in Java to accept a number
and check whether it belongs to the
Fibonacci Series (sequence) or not.
Fibonacci Series:
The Fibonacci Sequence is the series of
numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …
The first two numbers in the series is ‘0’ and
‘1’ and every next number is found by adding
up the two numbers before it.
The 2 is found by adding the two numbers
before it (1+1) Similarly, the 3 is found by
adding the two numbers before it (1+2), And
the 5 is (2+3), and so on!
Example: the next number in the sequence
above would be 21+34 = 55
Here is a longer list: 0, 1, 1, 2, 3, 5, 8, 13, 21,
34, 55, 89, 144, 233, 377, 610, 987, 1597,
2584, 4181, 6765, 10946, 17711, 28657,
46368, 75025, 121393, 196418, 317811…

Synopsis
9
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
In this program, WHILE LOOP
has been used. First, input is taken
from SCANNER CLASS. Then in
the loop, two main variables are
added and the value is added in the
third variable. Then, second
variable’s value is stored in the
first variable and the third
variable’s value is stored in the
second. The loop is continued till
infinity. Next, using IF-ELSE
STATEMENT, it is checked if the
input in in the Fibonacci Series.
Source Code
10
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
import java.util.*;

class Sample

public static void main(String args[])

Scanner sc = new Scanner(System.in);

System.out.println("Enter a number:");

int in = sc.nextInt();

int a = 0; int b = 1; int c=0;

while(c<in)

c = a + b;

a = b;

b = c;

if(c==in)

System.out.println("it is in the Fibonacci Series.");

else

System.out.println("It is not in Fibonacci Series.");

Input & Output Window

11
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Variable Description Table

Variable Data Type Use


a Int Storing smaller value

b Int Storing bigger value

c Int Storing sum

in int Input the number

Assignment-3
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 +

12
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
4*digit4 + 5*digit5 + 6*digit6 + 7*digit7 + 8*digit8 +
9*digit9 + 10*digit10 is divisible by 11.
Example: For an ISBN 1401601499 Sum=1*1 + 2*4 +
0*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 a 10-
digit number
(ii) If the ISBN is not a 10-digit number, output the
message “Illegal ISBN” and terminate the26 program
(iii) If the number is 10-digit, extract the digits of the
number and compute the sum as explained above. If the
sum is divisible by 11, output the message “Legal
ISBN”. If the sum is not divisible by 11, output the
message “Illegal ISBN”.

Synopsis
In this program, concept of Strings and
Functions has been used. First, the
number is input in a string variable.
13
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Then it is checked whether there are 10
digits or not. Then further using FOR
LOOP, each of its digit is multiplied
with its position and then added with
the other. At last, using conditional
statements it is checked if the remainder
of sum and 11 is 0. If yes, then
“LEGAL ISBN” is displayed. If not,
then “ILLEGAL ISBN” is displayed.

Source Code
import java.util.*;
class Sample
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a number:");
String in = sc.nextLine();
int len = in.length();
if(len!=10)
{
System.out.println("Illegal ISBN");
}

14
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
int sum = 0,num,i,pro;
for(i=0;i<=9;i++)
{
num = in.charAt(i);
pro = num * (i+1);
sum = sum + pro;
}
if(sum%11==0)
{
System.out.println("Legal ISBN");
}
else
{
System.out.println("Illegal ISBN");

Input & Output Window


}}
}

15 Variable Description Table


RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Variable Data Type Use
in String Input ISBN
len Int Length of ISBN
sum Int Adding digits
num Int Digits
i Int Position of digit
pro int Product of digit

Assignment-4
An Emirp number is a number
which is prime backwards and
forwards. Example: 13 is an
Emirp number since 13 and 31
are both prime numbers. Write
a program to accept a number

16
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
and check whether it is an
Emirp number or not.

Synopsis
In this program, nested loops and
conditional statements have been used.
First the number is input. Then using
FOR LOOP, it is checked if it is a
prime number. A variable in it was used
to do so. Further it is equated with
2( because a prime number can be
divided 2 times). If true, then by digit
chopping, it is reversed. In the next
step, the reverse number is checked
with the same method. Finally the
17
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
statement is displayed as per the
situation.

Source Code
import java.util.*;

class Sample

public static void main(String args[])

Scanner sc = new Scanner(System.in);

System.out.println("Enter a number:");

int in = sc.nextInt();

int oN = in;

int cv1 = 0, cv2 = 0, rN = 0, dig,i;

for(i=1; i<=in; i++){

if(in % i == 0)

cv1++;

if(cv1==2){

while(oN>0){

dig = oN % 10;

oN = oN / 10;

rN = rN * 10 + dig;

for(i=1; i<=rN; i++){

if(rN % i == 0){

cv2++;

if(cv2==2){

System.out.println("It is an Emirp Number.");

18
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
}

else{

System.out.println("It is not an Emirp Number.");

else{

Input & Output Window


System.out.println("It is not an Emirp Number.");

}}

Variable Description Table


Variable Data Type Uses
in Int Input number
oN Int Storing input
cv1 Int No. of divisions

19
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
cv2 Int No. of divisions
dig Int Enter digit
i Int Operate loop
rN int Reverse no.

Assignment-5
Write a menu driven program in Java to provide the
following options to generate and print output based on
user’s choice:
(a) To input a number and check whether it is a NEON
number or not
(b) To print the REPUNIT series: 1, 11, 111, 1111, ….
upto 'n' terms
(c) To print the sum of factorial of first n terms, where
n is input by the user.
For example if n=5 then sum=1+2+6+24+120=153
which is the sum of 1!+2!+3!+4!+5!
A number is said to be NEON, if sum of all the digits
of the square of the number is equal to the number
itself.
For example 9 is a NEON number. (Workings: Square
of 9 = 81. Sum of digits of square: 8 + 1 = 9) For an
incorrect menu choice an appropriate error message
should be displayed
20
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Synopsis
In this program, first input is taken to
know user’s choice. First option was to
check if input is a NEON NUMBER. First
its square was done then by digit chopping,
its sum was calculated. At last, using
conditions, answer was displayed.
Second option was of REPUNIT SERIES.
Here, the range of printing 1 together was
given by the user. Using FOR LOOP, the
task was done and the answer was
displayed.
Third option was the sum of factorial
series. Here, nested WHILE LOOP, was
used and the sum was displayed.

21
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Source Code
import java.util.*;
class Sample
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter 1 for NEON NUMBER:");
System.out.println("Enter 2 for REPUNIT SERIES:");
System.out.println("Enter 3 for FACTORIAL SERIES:");
int in = sc.nextInt();
switch(in)
{
case(1):
System.out.println("Enter a Number:");
int a = sc.nextInt();
int sqr = a * a; int dig,sum = 0;
while(sqr>0)
{
dig = sqr % 10;
sum = sum + dig;
sqr = sqr / 10;
}
if(sum==a){
System.out.println("It is a NEON NUMBER.");
}
else{
System.out.println("It is not a NEON NUMBER.");
}
break;
case(2):

22
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
System.out.println("Enter the range:");
int b = sc.nextInt();
int i,j=0;
for(i=1;i<=b;i++){
j = j * 10 + 1;
System.out.print(j+", ");
}
break;
case(3):
System.out.println("Enter the range for factorial sum:");
int c = sc.nextInt();
int f = 1; int fsum = 0; int l = 1,m = 1;
while(l<=c){
while (m<=l){
f = f * m;
m++;
}
fsum = fsum + f;
l++;
}
System.out.println("SUM:"+ fsum);

break;
default:
System.out.println("Error");
break;

}
}
}

23
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Input & Output Window

24
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Variable Description Table

Variable Data Type Uses


in Int Choice input

a Int Input number

sqr Int Calculating Square

dig Int Single digit

sum Int Sum of digit

b Int Input range

i Int Loop controller

J Int Displayed variable

c Int Input range

f Int Factorial

fsum Int Sum of factorial

l Int Loop control

m int Loop control

25
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Assignment-6
A Credit card company allows a limit to spend Rs. 15000 to
its clients. It also offers cash back facility according the table
shown below. Input the amount spent by the user and display
the cash back amount that he is entitled to.

Amount (in Rs.) Cash Back (in Rs.)


First 1000 100
Next 2000 200 + 2% of
amount exceeding 1000
Next 4000 400 + 4% of
amount exceeding 3000
Next 8000 800 + 8% of
amount exceeding 8000
Write a program to declare the class 'Credit' that takes in the
name of the client and the amount spend by him. Calculate the
cash back amount and print it along with all the other input
details.
(Assume there are 20 clients. Take details and print the
requisite output for each of them one by one.)

Synopsis
26
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
In this program, IF AND ONLY IF
STATEMENT is used.
First name is taken as input then the
amount spent.
If the amount is greater than 0, first
condition is satisfied.
Further, as per the question, cashbacks
with extra cashback is given.
In the first case, extra is 0; in second it
is 2% of amount above 1000 and in this
way, it was carried out.

Source Code
import java.util.*;
class Credit
{

27
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter your name:");
String name = sc.nextLine();
System.out.println("Enter your amount:");
float amt = sc.nextFloat(); double cb; double ecb = 0;double temp = amt;
if(amt>0){
if(amt==1000){
cb = 100 + ecb;
System.out.println("Amount entered: " + temp);
System.out.println("CashBack eligible: "+cb);

}
if(amt>1000 && amt<=3000){
ecb = 0.02 * (temp - 1000);
cb = 200 + ecb;
System.out.println("Amount entered: " + amt);
System.out.println("CashBack eligible: "+cb);
}
if(amt>3000 && amt<=7000){
ecb = 0.04 * (temp - 3000);
cb = 400 + ecb;
System.out.println("Amount entered: " + amt);
System.out.println("CashBack eligible: "+cb);
}
if(amt>7000 && amt<=15000){
ecb = 0.08 * (temp - 8000);
cb = 800 + ecb;
System.out.println("Amount entered: " + amt);

28
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
System.out.println("CashBack eligible: "+cb);
}
}
else{
System.out.println("Wrong Amount input.");
}
}
}

Variable Description Table


Variable Data Type Use
name string Input name
amt Int Input amount
cb Int General
cashback
ecb Int Additional
cashback
Input
temp & Output
int Window Storing
amount

29
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Assignment-7
An electronic shop has announced the following
seasonal discount on purchase of certain items.
Purchase amount in Discount on Laptop Discount on Desktop
Rs. PC
0-25000 0.0% 5.0%
25001-57000 5.0% 7.5%
57001-100000 7.5% 10.0%

30
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
More than 100000 10% 15.0%

Write a program based on the above criteria to


input name, address, amount of purchase, and
type of purchase (L or 1 for Laptop and D or 2 for
Desktop) by a customer. Compute and print the
net amount to be paid the customer along with
name and address.
[Hint : discount= (discount rate /100) * amount of
purchase Net amount= amount of purchase –
discount]

Synopsis
In this program, IF AND
ONLY IF STATEMENT is
used. First, name address and
choice has been taken. Then
31
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
choice was used in switch case
and further, using conditional
statements and jump
statements, the entire program
was executed.

Source Code
import java.util.*;

class Eletronics

public static void main(String args[])

Scanner sc = new Scanner(System.in);

System.out.println("Enter your name:");

String name = sc.nextLine();

System.out.println("Enter your address:");

String adr = sc.nextLine();

System.out.println("Enter L for Laptop and D for Desktop:");

String item = sc.nextLine();

switch(item){

case("L"):

32
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
System.out.println("Enter your amount:");

double amt = sc.nextDouble();

double dis = 0;double temp = amt; double namt = 0;

if(amt>0){

if(amt<=25000){

dis = 0;

namt = temp - dis;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis);

System.out.println("Net amount: "+namt);

break;

if(amt>25000 && amt<=57000){

dis = 0.05 * temp;

namt = temp - dis;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis);

System.out.println("Net amount: "+namt);

break;

if(amt>57001 && amt<=100000){

dis = 0.075 * temp;

namt = temp - dis;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis);

System.out.println("Net amount: "+namt);

break;

if(amt>100000){

dis = 0.1 * temp;

namt = temp - dis;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis);

System.out.println("Net amount: "+namt);

33
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
break;

else{

System.out.println("Wrong Input!");

break;

case("D"):

System.out.println("Enter your amount:");

double amt1 = sc.nextDouble();

double dis1 = 0; double namt1 = 0; double temp1 = amt1;

if(amt1>0){

if(amt1<=25000){

dis1 = 0.05 * temp1;

namt1 = temp1 - dis1;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis1);

System.out.println("Net amount: "+namt1);

break;

if(amt1>25000 && amt1<=57000){

dis1 = 0.075 * temp1;

namt1 = temp1 - dis1;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis1);

System.out.println("Net amount: "+namt1);

break;

if(amt1>57001 && amt1<=100000){

dis1 = 0.1 * temp1;

namt1 = temp1 - dis1;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis1);

System.out.println("Net amount: "+namt1);

break;

34
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
}

if(amt1>100000){

dis1 = 0.15 * temp1;

namt1 = temp1 - dis1;

System.out.println("Name: "+ name);

System.out.println("Address: "+adr);

System.out.println("Discount: "+dis1);

System.out.println("Net amount: "+namt1);

break;

else{

System.out.println("Wrong Input!");

break;

default:

Input & Output Window


System.out.println("Error:");

break;

}}}

35
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Variable Data Type
name String
adr String
item String
amt Double
dis Double
temp Double
namt Double
amt1 Double
dis1 Double
36
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Variable
temp1 Description
Double Table Store amount

Calculate net amount


namt1 Double

Assignment-8
Mr. A. P. Singh is a software engineer. He pays
annual income tax as per the given table:
Annual Salary Rate of Income Tax
Upto Rs. 100000 No Tax
Rs.100001 to Rs.150000 10% of the amount
exceeding Rs.1 ,00,000
Rs.150001 to Rs.250000 Rs.5000 + 20% of the
amount exceeding
Rs.1,50,000
Above Rs.250000 Rs.25,000 + 30% of the
amount exceeding
37
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Rs.2,50,00

Write a program in Java to compute the


income tax to be paid by him.

Synopsis
In this program, IF AND
ONLY IF STATEMENT has
been used. First input is taken
from the user. In the first
condition, if amount is equal to
38
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
0, wrong input message is
displayed.
In the second condition,
amount below 100k got no tax.
Similarly like this , other
Source Code
conditions are fulfilled
import java.util.*;

class Taxation

public static void main(String args[])

Scanner sc = new Scanner(System.in);

System.out.println("Enter your Annual Salary:");

double sal = sc.nextDouble();

double tax, etax, temp = sal;

if(temp==0){

System.out.println("Wrong Input!");

if(temp>0 && temp<=100000){

etax = 0;

tax = 0;

System.out.println("Tax: "+tax);

if(temp>100001 && temp<=150000){

39
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
etax = temp - 100000;

tax = 0.1 * etax;

System.out.println("Tax: "+tax);

if(temp>150001 && temp<=250000){

etax = 0.2 * (temp-150000);

tax = 5000 + etax;

System.out.println("Tax: "+tax);

if(temp>250000){

etax = 0.3 * (temp - 250000);

Input & Output Window


}}}
tax = 25000 + etax;

System.out.println("Tax: "+tax);

Variable Description Table

40
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Variable Data Uses
Type
sal Double Input salary
tax Double Calculate tax
etax Double Additional tax
temp Double Store salary

41
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Assignment-9
Write a menu driven program to generate the
uppercase letters from Z to A and lowercase
letters from a to z as per the user’s choice.
Enter ‘1’ to display upper case letters and ‘2’ for
lower case letters.

Synopsis
In this program, first input is to be taken
from the user regarding its choice. Then
the input will be used as a counter variable
in the switch case for performing the given
task. In the first case, letters from ‘Z’ to
‘A’ will be printed using their respective
ASCII codes. In the second case, letters
from ‘a’ to ‘z’ will be displayed using the
same phenomenon.

42
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Source Code

43
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File
Bibiliography
The following PROJECT WORK is for the
academic session of 2021-22 for class 10th.
It has been completed by Rushil Mishra of
W. H. SMITH MEMORIAL SCHOOL.
The work has got 8 assignments with its
synopsis, source code, input and output
window and the variable description table.
The work has been entirely done from the
concepts explained in the class lectures.
No external references has been taken;
neither from any website, nor from any
book.

Thank You
Rushil Mishra

44
RUSHIL MISHRA/10TH B/ ICSE 2021/Computer Application/Practical File

You might also like