Project Work (Computer Application) For Class-10 (Science)
Project Work (Computer Application) For Class-10 (Science)
(PART-1)
Class-X (Science)
Program-1
Mr. Kumar is an LIC agent. He offers discount to his policy holders on the annual premium.
However, he also gets commission on the sum assured as per the given tariff.
Up to ₹ 1,00,000 5% 2%
Write a program to input name of the policy holder, the sum assured and first annual premium.
Calculate the discount of the policy holder and the commission of the agent.
The program displays all the details as:
Name of the policy holder :
Sum assured :
Premium :
Discount on the first premium :
Commission of the agent :
Solution:
import java.util.Scanner;
public class LICPolicy
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter Name: ");
String name = in.nextLine();
System.out.print("Enter Sum Assured: ");
double sum = in.nextDouble();
System.out.print("Enter First Premium: ");
double pre = in.nextDouble();
double disc = 0.0, comm = 0.0;
if(sum <= 100000)
{
disc = pre * 5.0 / 100.0;
comm = sum * 2.0 / 100.0;
}
else if(sum <= 200000)
{
disc = pre * 8.0 / 100.0;
comm = sum * 3.0 / 100.0;
}
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
else if(sum <= 500000)
{
disc = pre * 10.0 / 100.0;
comm = sum * 5.0 / 100.0;
}
else
{
disc = pre * 15.0 / 100.0;
comm = sum * 7.5 / 100.0;
}
Program-2
Write a program to input a number and check and print whether it is a 'Pronic' number or not. Use
a function int Pronic (int n) to accept a number. The function returns 1, if the number is 'Pronic',
otherwise returns zero (0).
(Hint: Pronic number is the number which is the product of two consecutive integers)
Examples:
12 = 3 * 4
20 = 4 * 5
42 = 6 * 7
Solution:
import java.util.Scanner;
public class PronicNumber
{
public int pronic(int n)
{
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
int isPronic = 0;
Output
Program-3
A cloth showroom has announced festival discounts and the gifts on the purchase of items, based
on the total cost as given below:
Up to ₹ 2,000 5% Calculator
Solution
import java.util.Scanner;
public class CostDiscount
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter total cost: ");
double cost = in.nextDouble();
String gift;
double amt;
if (cost <= 2000.0)
{
amt = cost - (cost * 5 / 100);
gift = "Calculator";
}
else if (cost <= 5000.0)
{
amt = cost - (cost * 10 / 100);
gift = "School Bag";
}
else if (cost <= 10000.0)
{
amt = cost - (cost * 15 / 100);
gift = "Wall Clock";
}
else
{
amt = cost - (cost * 20 / 100);
gift = "Wrist Watch";
}
System.out.println("Amount to be paid: " + amt);
System.out.println("Gift: " + gift);
}
}
Output
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Program-4
The volume of solids, viz. cuboid, cylinder and cone can be calculated by the formula:
1. Volume of a cuboid (v = l*b*h)
2. Volume of a cylinder (v = π*r2*h)
3. Volume of a cone (v = (1/3)*π*r2*h)
Using a switch case statement, write a program to find the volume of different solids by taking
suitable variables and data types.
Solution:
import java.util.Scanner;
public class MenuVolume
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("1. Volume of cuboid");
System.out.println("2. Volume of cylinder");
System.out.println("3. Volume of cone");
System.out.print("Enter your choice: ");
int choice = in.nextInt();
switch(choice)
{
case 1:
System.out.print("Enter length of cuboid: ");
double l = in.nextDouble();
System.out.print("Enter breadth of cuboid: ");
double b = in.nextDouble();
System.out.print("Enter height of cuboid: ");
double h = in.nextDouble();
double vol = l * b * h;
System.out.println("Volume of cuboid = " + vol);
break;
case 2:
System.out.print("Enter radius of cylinder: ");
double rCylinder = in.nextDouble();
System.out.print("Enter height of cylinder: ");
double hCylinder = in.nextDouble();
double vCylinder = (22 / 7.0) * Math.pow(rCylinder, 2) * hCylinder;
System.out.println("Volume of cylinder = " + vCylinder);
break;
case 3:
System.out.print("Enter radius of cone: ");
double rCone = in.nextDouble();
System.out.print("Enter height of cone: ");
double hCone = in.nextDouble();
Output:
Program-5
Given below is a hypothetical table showing rate of income tax for an India citizen, who is below
or up to 60 years.
Up to ₹ 2,50,000 Nil
Write a program to input the name, age and taxable income of a person. If the age is more than
60 years then display the message "Wrong Category". If the age is less than or equal to 60 years
then compute and display the income tax payable along with the name of tax payer, as per the
table given above.
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Solution:
import java.util.Scanner;
public class IncomeTax
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter Name: ");
String name = in.nextLine();
System.out.print("Enter age: ");
int age = in.nextInt();
System.out.print("Enter taxable income: ");
double ti = in.nextDouble();
double tax = 0.0;
if (age > 60) {
System.out.print("Wrong Category");
}
else
{
if (ti <= 250000)
tax = 0;
else if (ti <= 500000)
tax = (ti - 160000) * 10 / 100;
else if (ti <= 1000000)
tax = 34000 + ((ti - 500000) * 20 / 100);
else
tax = 94000 + ((ti - 1000000) * 30 / 100);
}
System.out.println("Name: " + name);
System.out.println("Tax Payable: " + tax);
}
}
Output:
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Program-6
An employee wants to deposit certain sum of money under 'Term Deposit' scheme in Syndicate
Bank. The bank has provided the tariff of the scheme, which is given below:
Write a program to calculate the maturity amount taking the sum and number of days as inputs.
Solution:
import java.util.Scanner;
public class TermDeposit
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter sum of money: ");
double sum = in.nextDouble();
System.out.print("Enter number of days: ");
int days = in.nextInt();
double interest = 0.0;
if (days <= 180)
interest = sum * 5.5 / 100.0;
else if (days <= 364)
interest = sum * 7.5 / 100.0;
else if (days == 365)
interest = sum * 9.0 / 100.0;
else
interest = sum * 8.5 / 100.0;
double amt = sum + interest;
System.out.print("Maturity Amount = " + amt);
}
}
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Output
Program-7
Using switch statement, write a menu driven program for the following:
(a) To find and display the sum of the series given below:
1 2 3 4 5 20
S = x - x + x - x + x - ............ - x ; where x = 2
Solution:
import java.util.Scanner;
public class SeriesMenu
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("1. Sum of the series");
System.out.println("2. Display series");
System.out.print("Enter your choice: ");
int choice = in.nextInt();
switch (choice)
{
case 1:
int sum = 0;
for (int i = 1; i <= 20; i++)
{
int term = (int)Math.pow(2, i);
if (i % 2 == 0)
sum -= term;
else
sum += term;
}
System.out.println("Sum=" + sum);
break;
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
case 2:
int term = 1;
for (int i = 1; i <= 5; i++)
{
System.out.print(term + " ");
term = term * 10 + 1;
}
break;
default:
System.out.println("Incorrect Choice");
break;
}
}
}
Output
Program-8
Write a menu driven class to accept a number from the user and check whether it is a Palindrome
or a Perfect number.
(a) Palindrome number: (A number is a Palindrome which when read in reverse order is same as
in the right order)
Example: 11, 101, 151 etc.
(b) Perfect number: (A number is called Perfect if it is equal to the sum of its factors other
than the number itself.)
Example: 6 = 1 + 2 + 3
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Solution:
import java.util.Scanner;
public class PalinOrPerfect
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("1. Palindrome number");
System.out.println("2. Perfect number");
System.out.print("Enter your choice: ");
int choice = in.nextInt();
System.out.print("Enter number: ");
int num = in.nextInt();
switch (choice)
{
case 1:
int copyNum = num;
int revNum = 0;
while(copyNum != 0)
{
int digit = copyNum % 10;
copyNum /= 10;
revNum = revNum * 10 + digit;
}
if (revNum == num)
System.out.println(num + " is palindrome");
else
System.out.println(num + " is not palindrome");
break;
case 2:
int sum = 0;
for (int i = 1; i <= num / 2; i++)
{
if (num % i == 0)
{
sum += i;
}
}
if (num == sum)
System.out.println(num + " is a perfect number");
else
System.out.println(num + " is not a perfect number");
break;
default:
System.out.println("Incorrect Choice");
break;
}}}
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Output:
Program-9
A Mega Shop has different floors which display varieties of dresses as mentioned
below:
1. Ground floor : Kids Wear
2. First floor : Ladies Wear
3. Second floor : Designer Sarees
4. Third Floor : Men's Wear
The user enters floor number and gets the information regarding different items of the Mega shop.
After shopping, the customer pays the amount at the billing counter and the shopkeeper prints the
bill in the given format:
Write a program to perform the above task as per the user's choice.
Solution:
import java.util.Scanner;
public class MegaShop
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println("1. Ground floor");
System.out.println("2. First floor");
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
System.out.println("3. Second floor");
System.out.println("4. Third floor");
System.out.print("Select a floor: ");
int floor = in.nextInt();
boolean isFloorValid = true;
switch (floor)
{
case 1:
System.out.println("Kids Wear");
break;
case 2:
System.out.println("Ladies Wear");
break;
case 3:
System.out.println("Designer Sarees");
break;
case 4:
System.out.println("Men's Wear");
break;
default:
isFloorValid = false;
System.out.println("Incorrect Floor");
break;
}
if (isFloorValid)
{
System.out.print("Enter bill amount: ");
double amt = in.nextDouble();
System.out.println("Name of the Shop: City Mart");
System.out.println("Total Amount: " + amt);
System.out.println("Visit Again!!");
}
}
}
Output
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Program-10
'Bajaj Electronics' has announced the following seasonal discounts on purchase of certain items.
Write a program to input name, amount of purchase and the type of purchase (`L' for Laptop and
'D' for Desktop) by a customer. Compute and print the net amount to be paid by a customer along
with his name.
(Net amount = Amount of purchase - discount)
Solution:
import java.util.Scanner;
public class ElectronicsSale
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter Name: ");
String name = in.nextLine();
System.out.print("Enter Amount of Purchase: ");
double amt = in.nextDouble();
System.out.println("Enter Type of Purchase");
System.out.print("'L'- Laptop or 'D'- Desktop: ");
char type = in.next().charAt(0);
type = Character.toUpperCase(type);
double disc = 0.0;
if (amt <= 25000)
disc = type == 'L' ? 0.0 : 5.0;
else if (amt <= 50000)
disc = type == 'L' ? 5.0 : 7.0;
else if (amt <= 100000)
disc = type == 'L' ? 7.5 : 10.0;
else
disc = type == 'L' ? 10.0 : 15.0;
double netAmt = amt - (disc * amt / 100);
System.out.println("Name: " + name);
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
System.out.println("Net Amount: " + netAmt);
}
}
Output
Program-11
The class teacher wants to store the marks obtained in English, Maths and Science of her class
having 5 students. Write a program to input marks in Eng., Science and Maths by using three single
dimensional arrays. Calculate and print the following information:
(i) Average marks secured by each student.
(ii) Class average in each subject.
[Hint: Class average is the average marks obtained by 5 students in a particular subject.]
Solution:
import java.util.Scanner;
public class SDAMarks
{
public static void main(String args[])
{
final int TOTAL_STUDENTS = 5;
Scanner in = new Scanner(System.in);
int english[] = new int[TOTAL_STUDENTS];
int maths[] = new int[TOTAL_STUDENTS];
int science[] = new int[TOTAL_STUDENTS];
double avgMarks[] = new double[TOTAL_STUDENTS];
for (int i = 0; i < TOTAL_STUDENTS; i++)
{
System.out.println("Enter student " + (i+1) + " details:");
System.out.print("Marks in English: ");
english[i] = in.nextInt();
System.out.print("Marks in Maths: ");
maths[i] = in.nextInt();
System.out.print("Marks in Science: ");
science[i] = in.nextInt();
avgMarks[i] = (english[i] + maths[i] + science[i]) / 3.0;
}
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
int engTotal = 0, mathsTotal = 0, sciTotal = 0;
for (int i = 0; i < TOTAL_STUDENTS; i++)
{
System.out.println("Average marks of student " + (i+1) + " = " + avgMarks[i]);
engTotal += english[i];
mathsTotal += maths[i];
sciTotal += science[i];
}
System.out.println("Class Average in English = " + ((double)engTotal / TOTAL_STUDENTS));
System.out.println("Class Average in Maths = " + ((double)mathsTotal / TOTAL_STUDENTS));
System.out.println("Class Average in Science = " + ((double)sciTotal / TOTAL_STUDENTS));
}
}
Output:
Program-12
Write a program in Java to store 20 numbers in a Single Dimensional Array (SDA). Display the
numbers which are prime.
Sample Input:
n[0] n[1] n[2] n[3] n[4] n[5] ... n[16] n[17] n[18] n[19]
45 65 77 71 90 67 ... 82 19 31 52
Output:
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Program-13
Write a program to accept name and total marks of N number of students in two single subscript
arrays name[ ] and totalmarks[ ].
Calculate and print:
(i) The average of the total marks obtained by N number of students.
[average = (sum of total marks of all the students)/N]
(ii) Deviation of each student's total marks with the average.
[deviation = total marks of a student - average]
Solution:
import java.util.Scanner;
public class StudMarks
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print("Enter number of students: ");
int n = in.nextInt();
String name[] = new String[n];
int totalmarks[] = new int[n];
int grandTotal = 0;
for (int i = 0; i < n; i++)
{
in.nextLine();
System.out.print("Enter name of student " + (i+1) + ": ");
name[i] = in.nextLine();
System.out.print("Enter total marks of student " + (i+1) + ": ");
totalmarks[i] = in.nextInt();
grandTotal += totalmarks[i];
}
double avg = grandTotal / (double)n;
System.out.println("Average = " + avg);
for (int i = 0; i < n; i++) {
System.out.println("Deviation for " + name[i] + " = "
+ (totalmarks[i] - avg));
}
}
}
Output
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Program-14
Write a program in Java to store 10 numbers (including positive and negative numbers) in a Single
Dimensional Array (SDA). Display all the negative numbers followed by the positive
numbers without changing the order of the numbers.
Sample Input:
n[0] n[1] n[2] n[3] n[4] n[5] n[6] n[7] n[8] n[9]
Sample Output: -32, -41, -19, 44, 15, 21, 54, 61, 71, 52
Solution:
import java.util.Scanner;
public class SDANumbers
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int arr[] = new int[10];
System.out.println("Enter 10 numbers");
for (int i = 0; i < arr.length; i++)
{
arr[i] = in.nextInt();
}
Output:
COMPUTER APPLICATION FINAL PROJECT WORK FOR (ICSE)
(PART-1)
Class-X (Science)
Program-15
Write a program to store 20 numbers in a Single Dimensional Array (SDA). Now, display only those
numbers that are perfect squares.
n[0] n[1] n[2] n[3] n[4] n[5] ... n[16] n[17] n[18] n[19]
12 45 49 78 64 77 ... 81 99 45 33
Solution:
import java.util.Scanner;
public class PerfectSquares
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int arr[] = new int[20];
System.out.println("Enter 20 numbers");
for (int i = 0; i < arr.length; i++)
{
arr[i] = in.nextInt();
}
System.out.println("Perfect Squares are:");
for (int i = 0; i < arr.length; i++)
{
double sr = Math.sqrt(arr[i]);
if ((sr - Math.floor(sr)) == 0)
System.out.print(arr[i] + ", ");
}
}
}
Output: