Sei sulla pagina 1di 18

=

uwpo!'tL
l*n*hl'x;
v111"Yrba*Q

dAA
11

ir* n"o I Lnrx*?


I
e uoid roa'{n{
pr,r[,tie.ct&-gl
(
rrm rwrw'bsnr();
' ** bear obJ;

ebi, qatnurt1;
$rI 'vd*'Prwmil;
qu
)

uetd- $clruemf)
t

S(Anna..gc:

rt,etug}en:at {cgek'n'r'id;

(" {*rh' ro* weX"$;


9td.an,a)..'Pi**
^A= sc'nLYxhv();
K ; e*terk h);

0v* trarn)
pubttt int $neCk
F

'

f.:0 ,'

ft'*
;eq

1 4 1 {:A i

in"t"t=liazh;i+r 1

t_

s+ = uj
4 Lt==vumv)
L c4 +,,
btcuk;
a

( ( sl * )

LOnfrf\jJ,{,/

t ((> r,l*r,da
bxnat";

i 4 C c == f)
yet wn 7.)
ekt
n*ktun A;

fusPum()
vaLd,
Pu,talM
L r r uu
x' xi.{
L 6 (y==l )

r tl
;
Ll.,r.u/'"t
t\4'4"4f
t
c*'b
7o /^( " nattntb
okt
n N 0T ht'Lrrfld"a^"))

sop|n('' rwrnbc',-

3
1

DataMembers:
Str: To store a string.

Revs!:To store the reverseString


Member Functions:
void getStr():to acceptthe string
to reversethe string usingRecursive
void recReverse(int):
Technique.
void check(): To displaythe originalstring,reversedstring and
checkwhetherthe stringis palindromeor not.
Specifythe classRevstrgivingdetailsof all the member functions.You
needto write the main function also.

i m1iofri" !'"il)$fflfr {$ r:{it*.c


r

l: * j.,:t ri'i.'},ri!

l.t,{,
l: r-t.L
t
l.

L Lwx"C.d-, iw n *)

t nt A ? L | J { 3 t , &&,3 6 . "
9eannP'^tt''rd Cn:0.

tl.tl t r0;

*t {rr"m>l}
{

L- _ D )
uJt;tU,( t,< mm*l)
i
7'
d,n*=atI iJ;
L++)
?
J

$s = dn r#d;

3
lr

L, (( n m : : i )
I

dnrdC;

l,

s*l',;r*{,#n}r
L

dfiA Fin^dJrta>o
{. Lrrhn, *
Fit't^atWt 0
L tn=-D,n*D;3

fy egetlvt*x{.W*x,ivt't'V}
t

M :Tt

l l =l { ,

L^b lz-= fWdA, rr)e* & r


V);

_ ttdhuttth

ki

il"tub FiW 9&ee ex.bea,afxF t rU*na*


' t- L^h r:$ tz
Fi rva-qxzat ()
W-CI,K=0 , n * Oi

.d

t1etflrLa*lO* X, LnL fL , LfL

t"twL
I
q

)
lL=% tV=^z=E
,

'6brff

d8x)

z)

W&exh1L;

ed (g?n rt, "Vr*J


n^?h,'U"rn
Vl

r.A( z?a ,FIx> *\

,vg

,t!'&Wa1*z-;

t
,*A*grruird"dJ;
o

L,

m
/3'S"v.

fs

{
@

t &&,& &
f'N&
a lV ) W

?'g;'

ny* .7 &)

Ftxdfrt*rus&j e, ttr'swf rv&naw {\ U

,u

\J
.{

v,

*
#. s{1.qe*ak L^lin{i

r ''

ti,lefudwaAefo1. tnau.l
fiw&.{Fucet{);
L^.rL -- oto6,qq.L/nary
(nt tnfu nS);
v .,
gopt*
talu

tr)ate:
QU ES T I O Ns

the bi-r,rkpet'd.t'v.As pc| tlre


A library issuesa book on rental basisat a26h cl'ttxgeun the cpst price oi
the tiook is rctut'ttcdaitct' 7 tlrtys
rules of the library, a book can be retaineclfor 7 days without any fine . If
.
a fine will also be charged for the excessdays hs per the chall gii'eri below'

per day (Rs.t


i^-:-ie
l.0L)
3.00
5 . ()0

Number of excessdaYs
1to5
6 to1 0
above l0 daYs
Design a classLibrary and anotherclass
Class name
Data memberVinstance Yariables
name,author
p
Member functions/methods
Library( String n, String a, double np)
void show( )
Class name
Data members/instance variables
d
r

,rputetc perfortnthe task.The classesdetailsare as

-givctt:

l,ibrary
string variablesto storename of book and authorsname'
price of the book in decimals.
n to nanlc.
parameterizedconstructorto assigl the paratnete.rs
a to author and nP to P.
displaysthe book details.
Compute
number of days taken in returning the book.
to store the fine.
I

Member functions/methods
Compute(........)
void fine( )
void display( )

--i .*

parameterizedconstructorto assignvaluesto ciatanlembefs i


l;
of both the classes.
I
I
calculatesthe fine for the excessdays.
II '
days,
of
number
displays the book details along with the
I
fine and total amount to be paid as fine. The amount is i
I
calculatedas :
I
(i%o of price of book * total no. of days ) + fine
II

u
the concept of
Specify the class Library giving the details of the constru .tor and void show( ). Using
void
display( )
and
Inheritance, specify the classCompute giving the details of constructor, void fine( )
IISC 2009]
function.You do not needto write the main( ) function.

E rTTl

lIiFF

r,F.X-.Ff,lfltllG,r.:L.

A.S,

FG

i
t

II
l
t

149,,."

fw?t

r t - ji

lr

'^qrd ,f

-:

. ll o] Iro

,{r-:u.i.rf.*
ft,

.)

ivrt t, 1;
,
\
, lz-. //*\J
c n ' )i +\' 1 )
--4,

- i-rx (3C',
J++)
nL/'
J - ,/ J 1t7c)
n

,y,,b
,t, 2 ,

. rr:l
6eaq r J\ I

D{11
'

= l;

D-fv

7. t

A fz

(j"l/
f
f

l?

$^-- 3 ;
nr 3;

ttl l

)j

lr
I
t,

t2

i-

'
-

\
1
J

i f r, t

ir f it '

'
i
I

'Lr
I l,

tr^t,

r-i"!i

{ i -.tl ' r4 f\' r

lt\n ,
i
a

lf,'.
[-

1
, - r','j L . l- n -t ' ,lt + )
\
J-'

a
i
{-,
^^a

0nyti

rl

r-\
\ r

\r
r J' i

\ Ii

b.re{\'f#*(t

** "{ t t*-fk fe**,.rLi,a\;

I
3
i

! o,t*t"

l\

'
r\*.Sl1.1\
)

\{ f^'tu*\
\0r,L {" :o 1
\

'

r\, ; d n ' ,

.,

-i'
r 41 ' {

i1
'bt*,1',
"
L to\10'4,,( ct"t:"t'rl'rrl\
Y"'s p t t " nI\ \ ll

I
J
't

Y.t

ca"L(\

r\
Q-{Mj L*+\
(
L=ui
I 0r
t
{

* 3" 0t$d^,1 * a \
tr$L
rl
.n

r'
v

u{LL:= i)
to ' w w t oL't
z++\
,b fr L " = L'; <= As\ f lt t l\ i),

,{ [ru*tti]til

ol,L==m\

t&-Ufr\*,* * I
!
t

=* s ")
{ ffi"1"4'4^L,
S\I Yra-":

qunr\t ati lti);

[s*
! \) copfi*

gi;.r,ru,t'
{4
3 ,*
q -I:
4 rt'tm!

4n\ulns"L:
\

l e t I L- t ; Lz - r n- \ i L + + )

,^, ri-t.

rrfiA;Jt-'
) '-t-\

tg "{l'ti3{Y}- t

I]
t \-N-*[-z
\t:
8 l'U
1r!:**:*.

i,,Jt]
'3
'ii rltl
tcl
]-{r-0*

+ ax':'[ilLj1j
o'
:
urvt\
s(Irv\r
$
1n'n-\
nfit ntn*
^A,', W-, dfuL,\.,w"u$!
cdp
Lvrttlu
.\.
E
\
'-,f 'opvvr-a-,.*
=
+\vl\^\y
J-,'-'(ilJu^^"
QL
Vex,,wW1
c.xie-x"{i-A,

Ps u f ^( )

'/

(\ i
rurts'P
LLa-Q,
vtr-u
-n r\,
,\ phl
$ .. c'eu"
w a L q*r t - [ ;ob!
P =
t4
()',,

qcli) ;
r^'Utr'
.J.i

obi-':Lr-rotrr

9: The slope of a straight line is calculated as:


y2-y1
*r ^ =
*2-"1

t'

where (x1, y1) and.(x2, y2) are the coordinates of the first straight liire.
v4-v3
and rn2 :
x{x3
. where (x3, y3) and (x4, y4) arc the coordinates of the second str;right line.
If slope of both the lines is same, then the lines are parallel to each other arr,l
if the product of the slope is -1, then they are perpendicular to each other.
The details of both the classes are as:
Class name
Data members/Instance variables:

x7, y1-,x2, y2, x3, y3, x4, y4


slope

Point
To store coorclinates in double typt,
To store the slope of the line in doul'1,,
type.

Member functions/ methods:


Point0
void acceptPoint$
void Show$
Class name
Data members/Instancevariables:
m1, m2

-D

Member functions/ methods:


void findSlope$
void DisplayQ
void CheckQ

Constructor to assign 0 to x1, y1, r.),


y2, x3, y3, x4, y4.
To accept the values of the coorrli
natcs.
To clisplay values oft x1, yl, x2, v),
x3, y3, x4, y4.
Slope
To store the value in elouble ty1x.
using the formula:
y4-y3
v2-v7
n rl= --; -= ; ' t n ? ^
x4-x3
x2-x1
To store slopes of both the lines.
To show the magnitude of the slopt's
To determine whether the lines art,
parallel or perpendicular.

(a) Specify the class Point giving details of constructor, function void Show$, declar,. I

void acceptPoint$.
(b) Using the concept of inheritance, specify the class Slope by giving the details of tlrt'
functions void findSlope$, void DisplayQ and void Check$. The classSlope is clerivc,l
frorn the class Point.
-, r/.1;...
ltr
f
i I:!

W,,

UnderstandinglsCConputerScience
I SZ0

Prog.

Tl-reciistance benveen

p o in t s (r1 . v 1 ) a rrrl (x 2 , r' 2 ) i: ; c a lc u la rt e cals :

J t- l - . 2 ) r + ( \ ' 1 - " f t
An alrstractclass Point representsa poit"ttt-,tra 2D plane while another cl:rss
distance is declared to help in firrding ciistatrcebetrveen two points ancl mid
ooint. The details of both the classesare as:
Class name : Point
Data rnembers/ Instance variables:
x7, y1, x2, y 7 :

To store coordinates in double type.


dis : To store distance in double tYPe.

Member functions / methods:

Point0 : Constructorto assign0 to x1l'y"1,x2


and v2.
'ro
abstractvoid readPoint$ : To declareabstracttype function. \r
abstractvoid FindDistanceQ : To declareabstracttype function.
void Showo : To clisplayvalues of x1, Y1, x2 and

y2.

Class name
Data members/Instancevariables:
midx, midy

Distance
To store midx and midY coordinates
in double type.

Member functions/ methods:


abstractvoid readPoint$ : To input values of xL, yL, x2 and Y2
declared in the classPoint.
abstraCtvoid FindDistanceQ : To find the distance between poiuts
(x1, y1) and (x2, y2) declared in the
class Point.
void FindN{idPointfl : To find the distance between points
(*1, y1) and (*2, y2) declared in
the class Point. The rnid Point is
calculatedas: midx=(x1+x2)/2 and
midy= (y1+y2)/2.
void Show$ : To display values of dist, midx and
midy.
(o) Specify the class Point giving details of conskuctor, function'void Show0, declare

abstract void readPoint$ and abstract void FindDistance0.


(b) Using the concept of inheritance, specify the class Distance by giving the details of the
abstrict class functions abstract void readPoini$, abstract void FindDistance0, void
FindMidPoint$ and void Show0.
The class Distance is derived from the class Point.

Cill

^/vL

yf Il o-;
:--:

ct I
\

fl r*'-*
bJry

4 J Lrttr
---2
4-'-'

Date :

Q t i t , ) s ' t ' to N4
A hlrrk intends to design

a program to display the denominati


'|'|tclrvailabledenominafionswiththebankaretr*ffi;d;:%:iT::i;Ij"'.
l1'ons of an inputamount,upto 5

digits.

l)csign'a prograffrto acceptthe amount


from the user and display the break-up
in descendingorder of
dcnominations'{i'e' preferenceshould be given
to the iign"r, denominationsavailabre)
arong with the
total numberof notes' I Note : only the
denominationsusld shouldbe displayed].
Also
print
the amounr
in words accordingto the digits.
Test your program for the foilowing data
and some random data:

Example I :
Input :
14856
\Lic;6
Output : ONE FOUR
EIGHT

i*

Denominations:

FTVE SIX

1000 x
5 0 0x1
1 0 0x3
50xl
5 xl
l xl

L4

TOTAL
TOTAL NUMBER OF NOTES
Example2 :
Input :
6043
Output :
SIX

ZERO

Denominations:

FOUR

FIVE

1 0 0 0x6=
2 0 "x
2
xl xl -

=
=

14000
s00
300
50
5
I
14856
2l

THREE
2
l

=
-

TOTAL

6000
40
2
I
6043

TOTAL NUIVTBER
oF NOTES

l0

Example3 :
Input : 2?5001
Output : tNVeLm AMOUNT

lrsc 20101

2 t4
.*'.:..:i;-+rrr="oiri;,i.?.-r.l'*i*.;..i

: j:'i,

QUESTTON5
Thc cornputcrdepartment
of the agencyof International
Espionage
is trying to decode intercepted
mcssilgcs.
The agency'sspieshavedetermined
that the enemyencodesmessagesby first convertingall
chur;rclcrs
lo theirASCII valuesand then reversingthe string.
Frrr cxanrple,considerA_z (the underscoreis just to highlight the space).The ASCII values of A,
<spircc>,r. are 65, 32. 122 respectively.Concatenatethem to get 6532122, then relerse this to set
2212356as the codedmessase.
Writc a programwhich readsa coded messageand decodesit. The coded messagewill not exceed200
chitr i tclcrs.
Itwillcontainonlyalpha b e t s (A. . . Z , a n d a . . . . 2 ) a n d s p a c e s . A S Cllv a lu e s oAf. . . . Z a r e
65 ....9 0 andthoseof a... zare9l . . . . 1 2 2 .
'lbst your programfor the following data anil somerandom
data.
Sample data :
In p u t:
FlncodedMessage:
2 3 t2 t7 98623 t0 I 9950

I 81 231 923 t0 I 8 1 17e27

Output:
THE DECODED NIESSAGE :
llave A Nice Day
****

Input:
llncoded
2 . 15 l l 0 l 1 5 0 t7 8 2 -? 5 I 1 t2 L799r |801
Output:
.I'IIE DECODED
MESSAGE:
'l'ruth Always Wins

5 62340161 t7 |14 I 148

'i **

(t shouldbe capital ietters)


Answer:

*18

;:-rt;.ir;:it:
: rr,,,.,,,::r

lrsc 2fi)41

utEslor.r+
imPot"tt4*o uti(. *;
elass*enarniYqat(on

d
Voi& .fi4&|n()
u'^1'Yr,o0j
| $Y\,.e
t vt L0&[1 3 | tOOo,bo q^l?O

lo' 6 ) L) t t ' ^
' lb) f r ) '

ouN\N9"}
swi^fla$2[]={";tr^H'5-rw0",1"fHltLY"t*.
U
{frg*txrvJt
{rfinne^
*
wtlr.
kanrw rc
?i.^,
S

'

&to3rurnn'ban"!
0(JJ'Px'tv\*0t\( " Er'&zu

6sre'''ge

LnX ??:

'n-cx"t'$*tt();

s +}
i*
L4'"Mirur.r#I'|^t
fiot { bn* b*0J
gdhr\*ro

Lnt fi = wf a*tLilt
(trrrr = gnrnt"6)
Lbt$\.=F)
V\

+ b *" = " +
(oPa,;.
tusdl \l+" -)p'"
?r:. h "1,nPt[iJ

o"1ilrrb)'i

-tC

/r(b*

.3

/*-)

j
BopQJ^lt r*rw)

\g)

*P*
!*Y
sf Pu!\q L --

cd;
'6 Nk'fl^T

tt + )
\'
('tp Vo ;'r, r' $'enAtt'(
\a
+" ')
[" "+ t" Lh,oeoAtt])]
,[ar"*Ls
&on*.-]- 'u*
sop',ra"

,i

. l Cl l

, 1' : ; iur ir lt ' e r r c r . v p f i o n s \ j s t e n i


ilses a shifting
r allr e of t l i e s h i f t c a i l b e
i i l tlie rauge rrf
Shif t Valu e ' s h o u l d a p p e a r ) .

pr.occ3: (r, liiie

c i l i cl i d r i !

; ii<

I io 26 ir.,l!,,:r:lr.lu",
.,1*, li"".,rO

F o r e x a i n pl e, S hi ft 7 means
that A = U , B = V , C = !V ancl
so on________

Text: A B C D E F G H f
I K L M N O p e R S T Li V vV Xy
Z
Code: U V !V XY z A B C D
EFG H I JK L M N o P
Q R ST
An extra space is added to the
end of the.string. To
thi.gs a Iittle more
difficult, spaceswithinthe otigi";ri"*t
ur"."pru"ed 'rake
with ee before th-etext

(aai;"'
ffi$itft[oouble a
'"r".,"ail;';o

i.,grir],wordends

Additionally, the .*""d


is printed in blocks of six
c'aracters
separated by spaces.The ,message
last uro-"ctnright .ot .orrtuir.,
program that takes the coded
"i"" "trur".t"rs. write a
text (ress than 100
the shiff value
and prints the decoded original
t"*tl-y"o,,, program"r,ur*t"rr),
must
reject
any
value for shift. Assume alicharacter"
ur" in upper case.
^on_varid
Input coded rext : . UHINBYLKKeCHHYLKK
Shift
:
7
Decoded Text
:
ANOTHER WINNER
Input coded text :
RUIIGGEVGGBKSAGG
Shift
:
11
Decoded Text
:
BEST OF LUCK
lnput coded text :
RUIIGGEVGGBKSAGG
Shift
:
29
Output
:
Invalid Shift Value

frsc 20031

Input :
Output :

6043
SIX

ZERO

Denominations:

1000
20
2
I

FIVE
X

.x.
x
x

THREE
6
2
I
I

TOTAL
TOTAL NUMBER OF NOTES

Example3 :
Input : 235001
Output : INVALID AMOUNT

.2is

FOUR

=
6000
= 40
=2
=l
=
6A43
= 10

[rsc 2010]

Qu e sti on 1
"
Giventwo positivenumbersM and N, such that M is between
100 and 10000and N is less
than 100' Find the smallestinteg6r that is greatertfran
M and whose digitsadd up to N.
For example,if M=100 and N=1 1, then the lmallest integer
greater tnai t oo whosedigits
ad d u p to11is119.
write a programto accept the numbersM and N from the
user and print the smallest
requirednumberwhosesum of all its digitsis equal to
N. Also, print the total numberof
digitsplesentin the required number. T1e programshould
check for the validity of the
inputs and disprayan appropriatemessagefor an invalid
input.
Test your programwith the sampledatalnd somerandom
oata:
Example1
IN PUT:M =100
N=11
OUTPU T:
The requirednumber =119
Total numberof digits= 3
Example2
INPU T:M =1500
N = 25
OTJTPUT:
The required number = 1699
Total numberof digits=4
Example3
INPU T:M = 99
N = 11
OUTPUT:INVALIDtNpUT

Exampte

6043
SIX

Input z
Output :

Denominations:

ZERO

FOUR

THREE

1000x6=
20x?=
2xl=
lxl=
TOTAL
TOTAL NUMBER OF NOTES

Example3 :
Input z 2)JA0l
Output : INVALID AMOUNT

tt4

FIVE

6000
40
2
I
=

6043
10

IISC 20101

I/

:..

qv . . : l

.t.r

:-,

i e Finding
th"r,.,tu."
dare
n days
i.i:ff S:,':ff'J"",:'rf1;:i.ll5?']"r?Tifffi_r;ction
arter
the
number
of days berweenthe current
date and date

lr'::ilrr"*"

on which a prsjectends.

lii fi"['Ji:ilri,:l"k;"::it,iT*;!J:i-',1,,T",ftI?"j 32you


may
assum
convertedto its equivalent
;'"f:i:,ffi:1,1,"
easy
iate .,r^#.
each
date
Date
uate number
can be
numb", is
i, the
thit.li*u:rtllcufations

and the given date (dd-mm)


Example:

number of days between


1,t

Date (dd_mm)
01_01
20_07
02_a2
03_03

someof thetunctions/*"th"d:1o;"f*

January (01_01)

Date Number
1
20
33
62

dateare,no#Lro-,

Class name
Data membery'instance variables

:
:
:
:

dd
mm
Member functiony'methods
date (int nd, int nm)

ddte
IqIE

dav
month

intdatetod","""*.?i
, returns
::ffilT::"r::t::^ii:
the date number
obrect.

date datenumbertodate (
int dn )

ld,,* =run

equivalent to the current


date

tr*"

date futuredate ( int n


)

retu's

the date equivalent to the


given date number
the date that occurs n

days after the current


date
object'you may assurnethat
the future J"r"i"'r u" i"

sp"'i* the classdate


the
-giving detailsof the-:::ffry'Jfi-.ro*

iff:"#.#H:,,13,'*
*n:*]l*;

flJlli**#lh

rrvr wrrlc: ure matn tunction.

.d11"(int nd int nm),int

y.umay
;;;_u,ha,,he
VSC_ 200gi

,/

,.c:-:tstii"f't:z8

" A classNumbers
contains the following
data members and member
(A triangular number it
functions to.checkfor triangular
fot^;J;;
ihe additior,
numbers.
;;*",i""
eg.
,"i;;"'J'r"tegers
"i"
starting from 1.)
7+2-3
1+2+3=6
'1.+2+3+4=19
7+2+3+4+5=15
Therefore g, 6, 10,5 are
triangular numbers.
Class name
Data Members:

Numbers
rnteger to be checked
whether it is triangular
or not.

Member functions:
void gehrum$
int check(int)

-t
to
accepf integer n.
to check if n is triangular.
to. display rnessage ,iheth",

speciry
theclass
n is triangular or not.
Numbers al',TilJ?n"functions
voi
The main functtbn need noib"
d
ge
rn
um
int
fl, "n""t1ir.,ty
i.uJ .l"rl'olr"J""* ff
"#f ;;;;;."
.e-

il

i
/

-l^* 4 unn, drlf '-C uo'ft"

h cLa-vs ,rtd;[y
C*"Ll-s'
16u'*'ru 1/Wod;$d.
YWrwz '

CLa'\,6

-n

fu&* Yw*b*Ato

2 6h^ua& "tfrT

6
l
o
u
t
w
'
W4
t
t
r
"
o
'A
X"-)
) a-LLTt eL'*z

votd' ruAq

'ff"t"oa'<-

c'l^ol
i
C
e'^
uuod
P "b' ;f:r:ffi" U!*::S

ffird d"/.''o^y{t'sbi7

voLd balr-,od;0A

4'*
dti*q
*,
o
'
o

/U
l

ofd#''L
t

tl

t ) .- oo0,,. ,
-$usi'hiw "qn{ "tuP%
- ,.

veid, &"^4tL)

T"'

ft:

Cht^"+rn ,sbiq"
cJ"**d
'sf"-"''1, "
,
^
-) 1 '""-tlnce t;L
'-l'oro'tz'u

/*, d

o*:g*nJ at^sg*d

"W "-P*'*b!-di*o'n'*-

*l;L b""!

z me*a aLua'i

'
1 -:;: Xn ",o^n{u
Vn*

,r*n1y*o

w'd'bu -fu

'^a-UL

-#^*^'ttt-, "'04n^

'.:,

-ii

ii
'l',
tl

,l^.'

:l,la.-

T*EitLt.

lt*

(-'

{ - '/J -\ c:^:'

$ LtcJk 4 Lk

tu'^

( L({I('ltkntt, tN

i.,v

;:tt;f
AI

.,,/

t,

j J LTIII L nT II . /II t / A v
/

t^A
I /

L l_

aLa
/i,,o!fl,r,,
n,,A
L',,,rLlVar
c!..a.*s

Aol,,t'

/? ^

l_"ya^6

f"

A.[atu""
YWtuLbuq
Wl I YL

il

i /l

I tttCt tYLaK

lVlu*bu.o 'ltrn,twnz
f'*fu\AorO

nuvwbu
'twtnXu'tvoLtoLt"t Lr 'Sb*"
c to Mt (1
o,h*
6rcn
tc,
to
tctD^
: Grtstn"Lo't

O
iruhLf*r'no^.n'Fac'id
?::t"S'o*
A^**r#-{6,*t*r
/' ) n Al

eXP'n /\avw

: T'id"{i4u'oL

--1)
.r'fi?**t'F
nr'
U'Pa

^G
YWefx-c'x

Aouv'\

{rA

uv'O

" f) !, r i j ,_- r .:

/ ju
"
P'a-t-c+,n

e b F "f f i

gP z r c f t cM

,l

.b r'tt *
t\A

Clt'\4

J',-'

+f"
''\-{'2-

"

A^P

J Y La Ax*KvJ

n""n'u
:fffikmr;;::

n t, NL*"no'""
Atrr*]Mt0-r't-a-K't2^9"{L
fi**Ywwbuz'
u
&ouLl'
a^hLJ LJ +
'

:".";

oLKLtl"
u,;t;rt;g-#,-i

A^

,Y{rnolt.lvlu,,,J*;';:;

voA
tr;mi
s'c),n|j;l

w"&af^

'm'dln*''--*
e&
,o T*'^,?^vW
l
*^
^"*h;'
v \dd",# .n w Ci)

ffi#:;:f#r

v oi d

'W'o*r"*u

:*%
"*c1o*^do*-

+h*- o!'^' *iZ'uPt


" ll l. ot.

tf.-

n;,nr'rubW
\.1./t

nkS

Date :

QUESTION

bill
while anotherclass Sales defines the
salesman
a
of
data
perlonal
the
A.class Salesrnandefines
nameof the item' numb e ro f it e ms s o ld a n d p ric e o f t h d it e m. T h e d e t a ils o f c l a s s e s a r e a S :
ruumber,
Salesman
Class name
1
variables
Data members/instance
string variableto storename salesman'
name
string variableto storeaddress'
address
Member functions/methods
Salesman(;
ad)
n,
void readDetails(String String
void Show( )

and address'
constructorto assignblank to name
address'
to assign'n' to name and 'ad' to
using suitableheadings
to prini valuesof name and address
Sales

Class name
Data members/instance variables
billno' qtY
price, Psales
pname

integer to store bill number and quantity'


sales amount'
double type to store price and previous
string variable to store name of product'

Member functions/methods
p)
void readDetails(intb, int q' double
pr)
void readDetails(doubles, String
calcu

void Show()

price.
to billno, 'q' to qtY and 'p' to
'pr'to pname
to psales (Previoussales)and
furrnula-::
o
x
(qty) l+ previous sales (psales)
t Price (P) quantitf
qty' price' sales an
to disPlaYuulu., of pname, trillno,
total salesmade by invoking suitable function'

to assign
to assign

(a)

Specify the classSa!1ma1 givingdetailsofconstructor,functionsvoidreadDetails(String

(b)

specrrv
inheritance
:::J;'Jtr#or
carcurate
pr),doubre
":^l'l':-::l::lJ.tilii:"TffiiJ'1"":ff
y#b:ffi|il:T,:l ilffiffi;, 5iiareadDetans(doubre',-st'i"g

Siring ad) and void Show( )' '

ffiil;i';.-Y;;

Answer:

donot*"gio I:!" 91113'Tg:*91-

Potrebbero piacerti anche