0% found this document useful (0 votes)
8 views3 pages

X Assignment 7 To 9 PDF

The document outlines assignments for Grade X in Computer Applications, including programming tasks related to Niven numbers, EvenPal numbers, Armstrong numbers, and patterns using nested loops. It also includes object-oriented programming assignments involving classes for Eshop, Courier, and Student, detailing member variables and methods for each class. Instructions for formatting and submission of the assignments are provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

X Assignment 7 To 9 PDF

The document outlines assignments for Grade X in Computer Applications, including programming tasks related to Niven numbers, EvenPal numbers, Armstrong numbers, and patterns using nested loops. It also includes object-oriented programming assignments involving classes for Eshop, Courier, and Student, detailing member variables and methods for each class. Instructions for formatting and submission of the assignments are provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name: ______________________________ Grade : X Div.

: ___________________
Roll No. : _______ Date:______________ Term : I Assignment No: 7 to 9
Subject: Computer Applications Topic: Assignment Questions

Instructions:
Use double-sided ruled A4 size project sheets.
Write Questions using black pen.
Write the program and VDT using a blue pen.
These assignments are to be arranged after assignment 6 in proper sequence in the
Grade X Assignments file.
Assignment 7: (Number programs)

Example: 126

S
Q1. Write a program to input a number. Check and display whether it is a Niven number
or not. A number is said to be Niven if it is divisible by the sum of its digits.

Sum of its digits = 1 + 2 + 6 = 9 and 126 is divisible by 9


126 is a Niven number.
Q2. Define a class to accept a number from the user and check if it is an EvenPal number
LH
or not. (The number is said to be an EvenPal number when the number is a palindrome
number and the sum of its digits is an even number.)
A number is palindrome if it is equal to its reverse.
Example: 121 – is a palindrome number
Sum of the digits = 1+2+1 = 4 which is an Even number
121 is an EvenPal number.
Q3. Write a program to enter a three digit number and check whether the number is an
Armstrong number or not. A three digit number is said to be an Armstrong number if the
sum of cubes of the digits is equal to the original number.
Example: 153
153 is an Armstrong number because
Q4. Write a program to display all Pronic numbers in the range from 1 to n. A pronic
number is a number which is the product of two consecutive numbers in the form of
n*(n+1).
Example: 2, 6, 12, 20, 30, ………………… are pronic numbers
Assignment 8: (Nested for loop programs)
Q1. Write separate programs to display the following patterns with Variable Description
Table for each.

Page 1
2. 3. 4.
1 1 99999 *****
2 3 10 77777 ****
4 5 6 101 55555 ***
7 8 9 10 1010 33333 **
11 12 13 14 15 10101 11111 *

Q2. Write a menu driven program to display the following patterns as per User’s choice:
Option 1: Option 2:
1 55555
12 4444
123 333
1234 22
12345 1

Assignment 9: (Object Oriented programs)

Q1. Define a class called with the following specifications:


Class name: Eshop
Member variables:

S
String name: name of the item purchased
double price: Price of the item purchased
Member methods:
void accept(): Accept the name and the price of the item using the methods of Scanner
LH
class.
void calculate(): To calculate the net amount to be paid by a customer, based on the
following criteria:

Price Discount
1000 – 25000 5.0%
25001 – 57000 7.5%
57001 – 100000 10.0%
void display(): To display the name of the item and the net amount to be paid. 15.0 %
Write the main method to create an object and call the above methods.

Q2. DTDC Company charges for the courier based on the weight of the parcel. Define a
class with the following specifications:
Class name: Courier

Member Variables:
name – name of the customer
weight – weight of the parcel in kilograms
address – address of the recipient
bill – amount to be paid
type – ‘D’ for domestic and ‘I’ for International

Page 2
Member Methods:
void accept() – to accept the details using the methods of the Scanner class only.
void calculate() – to calculate the bill as per the following criteria:

Weight in Kgs Rate per Kg An additional amount of


₹ 1500 is charged if the type
First 5 Kgs ₹ 800 of the courier is I
Next 5 Kgs ₹ 700 (International)

Above 10 Kgs ₹ 500

void print() – to print the details


void main() – to create an object of the class and invoke the methods.

Q3. Design a class with the following specifications:

Class name: Student


Member variables:
name — name of student
age — age of student
mks — marks obtained
stream — stream allocated
S
LH
(Declare the variables using appropriate data types)
Member methods:
void accept() — Accept name, age and marks using methods of Scanner class.
void allocation() — Allocate the stream as per following criteria:

Marks Stream
> = 300 Science and Computer
> = 200 and < 300 Commerce and Computer
> = 75 and < 200 Arts and Animation
< 75 Try Again

void print() – Display student name, age, mks and stream allocated.
Call all the above methods in the main method using an object.

Page 3

You might also like