X Assignment 7 To 9 PDF
X Assignment 7 To 9 PDF
: ___________________
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.
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
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:
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