ICSE Class 10 - Computer Application Important Program (15 Marks)


Program 1- Define a class called Library with the following description:
Instance variables/data members:
Int acc_num – stores the accession number of the book
String title – stores the title of the book stores the name of the author
Member Methods:
(i) void input() – To input and store the accession number, title and author.
(ii)void compute – To accept the number of days late, calculate and display and fine charged at the rate of Rs.2 per day.
(iii) void display() To display the details in the following format:
Accession Number Title Author
Write a main method to create an object of the class and call the above member methods.
Solution - 

public class Library {

    int acc_num;
    String title;
    String author;

    public void input() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("Enter accession number: ");
        acc_num = Integer.parseInt(br.readLine());
        System.out.print("Enter title: ");
        title = br.readLine();
        System.out.print("Enter author: ");
        author = br.readLine();
    }

    public void compute() throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("Enter number of days late: ");
        int daysLate = Integer.parseInt(br.readLine());;
        int fine = 2 * daysLate;
        System.out.println("Fine is Rs " + fine);
    }

    public void display() {
        System.out.println("Accession Number\tTitle\tAuthor");
        System.out.println(acc_num + "\t" + title + "\t" + author);
    }

    public static void main(String[] args) throws IOException {
        Library library = new Library();
        library.input();
        library.compute();
        library.display();
    }
}




Program 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
Income Tax in
Does not exceed 1,60,000
Nil
Is greater than 1,60,000 and less than or equal to 5,00,000
( TI – 1,60,000 ) * 10%
Is greater than 5,00,000 and less than or equal to 8,00,000
[ (TI - 5,00,000 ) *20% ] + 34,000
Is greater than 8,00,000
[ (TI - 8,00,000 ) *30% ] + 94,000
Write a program to input the age, gender (male or female) and Taxable Income of a person.If the age is more than 65 years or the gender is 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.

Solution.
import java.util.Scanner;
 
public class IncomeTax {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter age: ");
        int age = scanner.nextInt();
        System.out.print("Enter gender: ");
        String gender = scanner.next();
        System.out.print("Enter taxable income: ");
        int income = scanner.nextInt();
        if (age > 65 || gender.equals("female")) {
            System.out.println("Wrong category");
        } else {
            double tax;
            if (income <= 160000) {                 tax = 0;             } else if (income > 160000 && income <= 500000) {                 tax = (income - 160000) * 10 / 100;             } else if (income >= 500000 && income <= 800000) {
                tax = (income - 500000) * 20 / 100 + 34000;
            } else {
                tax = (income - 800000) * 30 / 100 + 94000;
            }
            System.out.println("Income tax is " + tax);
        }
    }
}



Program 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.
Sample Input: “SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE
Sample Output: 4

Solution.
import java.util.Scanner;
 
public class StringOperations {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a String: ");
        String input = scanner.nextLine();
        input = input.toUpperCase();
        int count = 0;
        for (int i = 1; i < input.length(); i++) {
            if (input.charAt(i) == input.charAt(i - 1)) {
                count++;
            }
        }
        System.out.println(count);
    }

}


Program4- W 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 arguments 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.
Example: (i) Input value of n=2, ch=’O’ Output: OO OO (ii) Input value of x=2, y=5 Output: @@@@@ @@@@@ (iii) Output: * ** ***
Solution.
public class Overloading {
 
    public void polygon(int n, char ch) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                System.out.print(ch);
            }
            System.out.println();
        }
    }
 
    public void polygon(int x, int y) {
        for (int i = 1; i <= x; i++) {
            for (int j = 1; j <= y; j++) {
                System.out.print("@");
            }
            System.out.println();
        }
    }
 
    public void polygon() {
        for (int i = 1; i <= 3; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}

Program 5- Using the switch statement, writw a menu driven program to: (i) Generate and display the first 10 terms of the Fibonacci series 0,1,1,2,3,5….The first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two. (ii)Find the sum of the digits of an integer that is input. Sample Input: 15390 Sample Output: Sum of the digits=18 For an incorrect choice, an appropriate error message should be displayed
Solution.

import java.util.Scanner;
 
public class Menu {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Menu");
        System.out.println("1. Fibonacci Sequence");
        System.out.println("2. Sum of Digits");
        System.out.print("Enter choice: ");
        int choice = scanner.nextInt();
        switch (choice) {
            case 1:
                int a = 0;
                int b = 1;
                System.out.print("0 1 ");
                for (int i = 3; i <= 10; i++) {                     int c = a + b;                     System.out.print(c + " ");                     a = b;                     b = c;                 }                 break;             case 2:                 System.out.print("Enter a number: ");                 int num = scanner.nextInt();                 int sum = 0;                 while (num > 0) {
                    int rem = num % 10;
                    sum = sum + rem;
                    num = num / 10;
                }
                System.out.println("Sum of digits is " + sum);
                break;
            default:
                System.out.println("Invalid Choice");
        }
    }
}
 

Program6- 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’.
Solution.
import java.util.Scanner;
import java.util.Scanner;
 
public class Cities {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] cities = new String[10];
        int[] std = new int[10];
        for (int i = 0; i < 10; i++) {
            System.out.print("Enter city: ");
            cities[i] = scanner.next();
            System.out.print("Enter std code: ");
            std[i] = scanner.nextInt();
        }
        System.out.print("Enter city name to search: ");
        String target = scanner.next();
        boolean searchSuccessful = false;
        for (int i = 0; i < 10; i++) {
            if (cities[i].equals(target)) {
                System.out.println("Search successful");
                System.out.println("City : " + cities[i]);
                System.out.println("STD code : " + std[i]);
                searchSuccessful = true;
                break;
            }
        }
        if (!searchSuccessful) {
            System.out.println("Search Unsuccessful, No such city in the list");
        }
    }
}



Comments

  1. Can you write all programs in scanner class

    ReplyDelete
    Replies
    1. Yeah you can, but sometimes u may use buffered reader

      Delete
  2. If you want to know about some computer science knowledge than go to Extramarks and gain your basic knowledge.

    https://www.extramarks.com/study-material/icse-class-8/computer-science

    ReplyDelete
  3. good post
    http://yourfilmstars.blogspot.com/

    ReplyDelete
  4. Some of them are for class X not all.

    ReplyDelete
  5. AMAZING PROGRAMS FOR REVESION

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. BRUH this is the computer project for us class 10th folks. Like I gave my hell doing those 25 programs by my own and there were 60% students in my class who just copied them from your post
    I'm not despising you but its just.. just..does not feels fair you know :0
    Anyways good work man :) hehehe

    ReplyDelete
  9. Thanks for the amazing blog post. Ziyyara online ICSE home tutor interacts with parents and students on a regular basis and discuss student’s performance and they hold an experience in their niche. Online home tuition for ICSE classes is available at your fingertip, all you need is to register at our platform. We will assign the best tutors of your choice based on your needs and requirements.

    ReplyDelete
  10. Informative Blog, Thanks for sharing with us. In the 1 on 1 help for ICSE board provided by Ziyyara, a learner has an added advantage of choosing his/her own tutor. We help students in preparation for the icse board. ICSE board inculcates a sound logical approach in its learners by introducing practical application of knowledge from the initial stage.

    ReplyDelete
  11. Thank you for sharing such helpful information with us. I found this post really interesting. This information is really helpful for those who are looking for online ICSE home tuition classes

    ReplyDelete
  12. If you want to choose the online learning platform to get help for ICSE board exams, choosing Ziyyara Edutech for icse board exam preparation can help you not only clear the exams with flying colors but also help you understand every concept with maximum clarity.

    ReplyDelete
  13. Thank you for sharing useful information with us. please keep sharing like this. Our online classes shall help you with a better grip on the topic & chapter level. Please visit our website Free Live Classes

    ReplyDelete
  14. Thank you for details information

    ReplyDelete
  15. É bom, me ajudou muito, porém tenho que lembrar que felinos não é só gato. Vi que você retratou sobre outros ani여주출장샵mais, mas foi bem pouco.. Mesmo assim parabéns!

    ReplyDelete

Post a Comment

Popular posts from this blog

ICSE Class 10 - Computer Application Important Questions & Answers (2 Marks)

COMPUTER SCIENCE PRACTICAL SOLVED QUESTIONS - ISC BOARD 2018

Address Calculation in Single and Double Dimension Array - ISC Computer Science

ICSE CLASS 10 COMPUTER APPLICATION - Chapter 1: Concept of Objects

ISC Computer Science - Propositional Logic

COMPUTER SCIENCE PRACTICAL SOLVED QUESTIONS - ISC BOARD 2016

ICSE CLASS 10 COMPUTER APPLICATION - Chapter 2: The Java Phenomenon

Computer Science Paper 1 (Theory) - ISC 2018