LORVEN PUBLIC SCHOOL
Affiliated to CISCE New Delhi, Anekal Road, Chandapura-560081
3rd Monthly test, May-2023
Computer Applications
Name: Date: 27/6/2023
Class: X A Marks: 50 Marks
PART –A
I Answer the following. 2×5=10 Marks
1) What is real world object? Give 2 examples.
2) What is software object? Give 2 examples.
3) Write the syntax of creating object. Give an example.
4) Write the syntax of defining a class. Give an example.
5) What is a class variable? Mention any two features of class variables.
6) Differentiate between class variables and instance variables.
7) Explain any two types of access specifiers.
8) List the internal contents of Java.
9) What is a nested class? Give an example.
10) Why is a class known as composite data type?
PART –B
II Write any three of the following programs 2×5=10 Marks
1) Define a class Discount having the following description:
Class name: Discount
Data Members Purpose
int cost to store the price of an article
String name to store the customer's name
double dc to store the discount
double amt to store the amount to be paid
Member methods Purpose
void input() Stores the cost of the article and name of the customer
void cal() Calculates the discount and amount to be paid
List Price Rate of discount
Up to ₹5,000 No discount
From ₹5,001 to ₹10,000 10% on the list price
From ₹10,001 to ₹15,000 15% on the list price
Above ₹15,000 20% on the list price
void display() Displays the name of the customer, cost, discount and amount to be paid
Write a program to compute the discount according to the given conditions and display the output as per
the given format. Write a main method to create an object of the class and call the above member
methods.
Output:
Name of the customer Discount Amount to be paid
.................... ........ .................
2) Bank charges interest for the vehicle loan as given below:
Number of years Rate of interest
Up to 5 years 15%
More than 5 and up to 10 years 12%
Above 10 years 10%
Write a program to model a class with the specifications given below:
Class name: Loan
Data Members Purpose
int time Time for which loan is sanctioned
double principal Amount sanctioned
double rate Rate of interest
double interest To store the interest
double amt Amount to pay after given time
Member Methods Purpose
void getdata() To accept principal and time
To find interest and amount.
Interest = (Principal*Rate*Time)/100
void calculate() Amount = Principal + Interest
void display() To display interest and amount
Write a main method to create an object of the class and call the above member methods.
3) Design a class name ShowRoom with the following description:
Data Members Purpose
String name To store the name of the customer
long mobno To store the mobile number of the customer
double cost To store the cost of the items purchased
double dis To store the discount amount
double amount To store the amount to be paid after discount
Member Methods Purpose
void input() To input customer name, mobile number, cost.
void calculate() To calculate discount on the cost of purchased items, based on following criteria
Cost Discount (in percentage)
Less than or equal to ₹10000 5%
More than ₹10000 and less than or equal to ₹20000 10%
More than ₹20000 and less than or equal to ₹35000 15%
More than ₹35000 20%
void display() To display customer name, mobile number, amount to be paid after discount.
Write a main method to create an object of the class and call the above member methods.
4) A game of throwing dice is played between two players. Each player throws a dice unless his score adds up
to 20. The player getting score 20 in minimum number of throws is declared winner. Define a class Game
with the following specifications.
Data Members Purpose
String player1 To store first players name
String player2 To store secnd players name
String playernum1 To store the player number
String playernum2 To store the player number
Member Methods Purpose
void getdata() To accept player details
To play the game and add the score to respective
void play() player and cunt the number of throws.
void display() To display scores with players name and declare winner
Write the main method to create object of a class and call the above member methods.
5) Design a class with the following specifications to calculate area, perimeter and diagonal of a rectangle.
Data Members Purpose
int length To store length of rectangle
int breadth To store breadth of rectangle
Member Methods Purpose
void getdata() To accept length and breadth of rectangle
To calculate area, perimeter and diagonal
Formulas: area= length* breadth
Perimeter= 2*( length+breadth)
void calculate() Diagonal= √ length2+ breadth2
void display() To display the area, perimeter and diagonal
Write the main method to create object of a class and call the above member methods.
***ALL THE BEST***