0% found this document useful (0 votes)
10 views16 pages

Class 10 Programming Assignments Guide

The document contains a series of programming questions and solutions related to calculating factorials, profit and loss calculations, and volume computations using object-oriented programming and method overloading. Each question includes a coded solution, output, and variable descriptions. It is structured for a Class 10A student named Himanshu Raj.

Uploaded by

veinuix
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views16 pages

Class 10 Programming Assignments Guide

The document contains a series of programming questions and solutions related to calculating factorials, profit and loss calculations, and volume computations using object-oriented programming and method overloading. Each question includes a coded solution, output, and variable descriptions. It is structured for a Class 10A student named Himanshu Raj.

Uploaded by

veinuix
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1

© Himanshu Raj, Class 10A.


Copying strictly prohibited without
permission.

Name : HIMANSHU RAJ

CLASS 10 A ROLL-17
2

QUESTION 1(A):
WRITE A PROGRAM TO CALCULATE THE FACTORIAL
OF A NUMBER USING METHOD.
CODED SOLUTION:

OUTPUT:

variable description:

QUESTION1(B):
3

WRITE A PROGRAM TO FIND METHOD FACTORIAL OF


A NUMBER USING OOP
CODED SOLUTION:

OUTPUT:

variable description:

QUESTION 2:
Write the following program with the following specifications:

class name: Profit_Loss

Data members/Instant variables: int cp,sp


4
Member Method:

Profit_Loss : Default constructor to initialize cp,sp

void input (int a, int b): to assign a with cp and b with sp

void display (): To calculate and display either profit percent(pp) or loss percent (lp)

CODED SOLUTION:

OUTPUT:
5

Variable Description:

QUESTION 3:
6

CODED SOLUTION:

OUTPUT:
7

Variable Description:

QUESTION4:
Write a program with class name volume using function
overloading that compute the volume of cube, a sphere and
a cuboid.
Formula: volume of cube = s*s*s
8

Volume of sphere = 4/3*pi*r*r*r


Volume of cuboid = l*b*h.
CODED SOLUTION:

OUTPUT:
9

Variable Description:

QUESTION 5:
10

CODED SOLUTION:
11

OUTPUT:

Variable Description

QUESTION 6:
12

CODED SOLUTION:
13

OUTPUT:
14

variable description:
15

QUESTION 7:
WRITE A PROGRAM TO INPUT 10 NUMBERS IN A 1S
[Link] WETHER THE ELEMENT IS PRESENT
IN THE ARRAY USING LINEAR SEARCH

CODED SOLUTION:
16

OUTPUT:

variable description:

You might also like