Anda di halaman 1dari 15

SHRI RAM INSTIUTE OF TECHNOLOGY JABALPUR (M.P.

)
Department ! In!rmat"n Te#\$n%&'
Lab Assignment

Session: 2006-07
Subject: I.T-306 Computer programming IIIrd S! I.T

LIST "# \$%&I!'TS
1) Write a program to addition of any two no.
2) Write a program to generate Fibonacci series.
3) Write a program to print the table of any no.
4) Write a program to calculate simple interest.
5) Write a program to check whether the no. is prime or not.
) Write a program to display the image
!) Write a program to re"erse of gi"en no. and check whether it is e#ual or
\$ot.
%) Write a program to design simple calculator
&) Write a program to show digital clock.

1'). Write an e"ent procedure for the following(
)*) +o display the day for a gi"en date )ii) +o co"ert a te,t from lowercase
+o uppercase
11) Write a function procedure for the following(
)*) +o generate Fibonacci series up to the number pro"ided by the user.
-eries is to be displayed on form.
)ii) +o con"ert the temperature in Fahrenheit into .elsius.
12) Write an e"ent procedure to find the sum of numbers from 1 to selected
/alue. 0se a hori1ontal -crollbar to set the ma,imum "alue.
13) -outhern 2ailway has introduced some more trains to mark the 5'
th

3nni"ersary of *ndependence. Write an e"ent procedure to add the
\$ames of new trains to list as well delete the trains that will be no
4onger running. 5ake use of 4ist 6o, for list of trains.
14) *ndian 2ailway has introduced the facility of free pass to its retired
employees who are in and abo"e the grade 3. 6ased on the following
parameters the employee who is eligible to a"ail the facility can be
identified. )5ake use of 7ption 6uttons)
)*) 2etired 2ailway 8mployee)9:\$)
)***) 3bo"e ' years of age )9:\$)

15)<e"elop a program whose interface and operations are that of
.alculator. +his program is to be implemented by control array.
1)<e"elop a /isual 6asic program ha"ing a main menu. +his main menu
has two options( Co(ors and Si)e. .olors main menu option has two
submenu option( Fill Color and Exit .Fill .olor submenu option has in
option has three submenu options( 'orma(= !a*imi)e and !inimi)e .
1!)0sing 5<* form and four normal forms= write a program to ma,imi1e
and minimi1e all the four forms. <o this with creating a menu. 3lso
title all four forms "ertically and hori1ontally with menu options.
1%).reate a database in 5- 3ccess ha"ing a table containing four
fields)columns)
namely ( \$ame= .ategory= 1'th>percent= 12
th
>percent. 5ake
connecti"ity of this database to a /isual 6asic program that adds=
deletes and modifies the students records
1&) Write a /isual 6asic ?rogram to display numbers ) from 1 to 1') in
one column and its s#uare in second column . 5ake use of 5icrosoft
Fle, ;rid .ontrol in this program.

2') <esign an 8lectronic /oting 5achine in /isual 6asic for election for
which four
?olitical ?arties namely( 6@?= .7\$;28--= -? and 6-? are contesting.
-andeep /erma
4ect. *.+. <eptt
1. +o con"ert the temperature in Fahrenheit into .elsius.
?ri"ate -ub .ommand1A.lick))
<im tempF 3s <ouble
<im temp. 3s <ouble
tempF B /al)+e,t1.+e,t)
temp. B )tempF > 32) C 5 : &
+e,t2.+e,t B temp.
8nd -ub
?ri"ate -ub .ommand2A.lick))
+e,t1 B DD
+e,t2 B DD
+e,t1.-etFocus
8nd -ub
?ri"ate -ub .ommand3A.lick))
8nd -ub
2. +o generate Fibonacci series up to the number pro"ided by the
user. -eries is to be displayed on form
<im last 3s *nteger
<im ne,tt 3s *nteger
<im limit 3s *nteger
<im sum 3s *nteger
?ri"ate -ub .ommand1A.lick))
*f +e,t1 B DD +hen
5sg6o, D9ou ha"enEt pro"ided the numberD= "b7F.ancel=
DF367\$3..* -82*28-D
8,it -ub
8nd *f
limit B /al)+e,t1.+e,t)
last B '
ne,tt B 1
?rint last
While ne,tt GB limit
sum B last H ne,tt
?rint ne,tt
last B ne,tt
ne,tt B sum
Wend
Form1.Fore.olor B 2;6)'= '= 255)
8nd -ub
3. +o co"ert a te,t from lowercase to uppercase.
?ri"ate -ub .ommand1A.lick))
+e,t1.+e,t B 0.ase)+e,t1.+e,t)
8nd -ub
?ri"ate -ub .ommand2A.lick))
+e,t1 B DD
+e,t1.-etFocus
8nd -ub
?ri"ate -ub .ommand3A.lick))
8nd -ub
4. +o display the day for a gi"en date.
?ri"ate -ub .ommand1A.lick))
<im <3+ 3s <ate
<3+ B Format)+e,t1.+e,t= D<<:55:9999D)
+e,t2.+e,t B Format)<3+= DddddD)
8nd -ub
?ri"ate -ub .ommand2A.lick))
+e,t1 B DD
+e,t2 B DD
+e,t1.-etFocus
8nd -ub
?ri"ate -ub .ommand3A.lick))
8nd -ub
5. Write an e"ent procedure to find the sum of numbers from 1
to selected "alue. 0se a hori1ontal -crollbar to set the
ma,imum "alue
?ri"ate -ub I-croll1A.hange))
Form1..ls
?rint I-croll1./alue
8nd -ub
. -outhern 2ailway has introduced some more trains to mark
the 5'
th
anni"ersary of *ndependence. Write an e"ent
?rocedure to add the names of new trains to list as well delete
+he trains that will be no longer running. 5ake use of 4ist
6o,
for list of trains

?ri"ate -ub .ommand1A.lick))
4ist1.3dd*tem +e,t1.+e,t
+e,t1 B DD
5sg6o, D+rain 3dded to the listD= "b7F7nly= D*\$<8?8\$<8\$.8D
8nd -ub
?ri"ate -ub .ommand2A.lick))
<im n 3s *nteger
n B 4ist1.4ist*nde,

*f \$ot n GB >1 +hen
4ist1.2emo"e*tem n
8nd *f
5sg6o, D+rain <eleted from the listD= "b7F7nly=
D*\$<8?8\$<8\$.8D
8nd -ub

4ist1.3dd*tem D+35*4\$3<8 8J?D
4ist1.3dd*tem DF0-I*\$3;32 8J?D
4ist1.3dd*tem D6I7?34 8J?D
4ist1.3dd*tem D?3+I3\$ F7+D
8nd -ub
!. *ndian 2ailway has introduced the facility of free pass to its
retired employees who are in and abo"e the grade 3. 6ased on
the following parameters the employee who is eligible to a"ail
the facility can be identified. )5ake use of 7ption 6uttons)

?ri"ate -ub .ommand1A.lick))
*f .heck1./alue B 1 3nd .heck2./alue B 1
3nd .heck3./alue B 1 +hen
5sg6o, D?erson is 84*;*648 for passD= "b7F7nly=
D*ndian2ailwayD
8lse
5sg6o, D?erson is \$7+ 8ligible for passD= "b7F7nly=
D*ndian 2ailwayD
8nd *f
8nd -ub
%. Write a program to design simple calculator
<im ?re/al 3s <ouble
<im .urr/al 3s <ouble
<im 7peration 3s -tring
<im 2esult 3s <ouble
?ri"ate -ub .ommand1A.lick)*nde, 3s *nteger)
+e,t1 B DD
?re/al B .urr/al B 2esult B '
8nd -ub
?ri"ate -ub .omndA.lick)*nde, 3s *nteger)
*f +e,t1.+e,t B -tr)2esult) +hen
+e,t1 B DD
8nd *f
*f +e,t1.+e,t B D8D +hen
+e,t1 B DD
8nd *f
+e,t1.+e,t B +e,t1.+e,t K .omnd)*nde,)..aption
.urr/al B /al)+e,t1.+e,t)
8nd -ub
?ri"ate -ub .omnd<i"A.lick))
+e,t1.+e,t B DD
?re/al B .urr/al
*f \$ot 2esult B ' +hen
+e,t1 B DD
?re/al B 2esult
8nd *f

.urr/al B '
7peration B D:D
8nd -ub
?ri"ate -ub .omnd8#ualA.lick))
-elect .ase 7peration
.ase DHD
2esult B ?re/al H .urr/al
+e,t1.+e,t B -tr)2esult)
.ase D>D
2esult B ?re/al > .urr/al
+e,t1.+e,t B -tr)2esult)

.ase DCD
2esult B ?re/al C .urr/al
+e,t1.+e,t B -tr)2esult)
.ase D:D

*f .urr/al B ' +hen
+e,t1 B D8D
+e,t1.Font.6old B +rue
+e,t1.Fore.olor B "b6lue

8,it -ub
8nd *f

2esult B ?re/al : .urr/al
+e,t1.+e,t B -tr)2esult)

8nd -elect

8nd -ub
?ri"ate -ub .omnd5inusA.lick)*nde, 3s *nteger)
.urr/al B >.urr/al
+e,t1.+e,t B -tr).urr/al)
*f \$ot 2esult B ' +hen
+e,t1 B DD
+e,t1.+e,t B -tr)>2esult)
8nd *f

8nd -ub
?ri"ate -ub .omnd5ultiA.lick))
+e,t1.+e,t B DD
?re/al B .urr/al
*f \$ot 2esult B ' +hen
+e,t1 B DD
?re/al B 2esult
8nd *f

.urr/al B '
7peration B DCD
8nd -ub
?ri"ate -ub .omnd?lusA.lick))
+e,t1.+e,t B D D
?re/al B .urr/al
*f \$ot 2esult B ' +hen
+e,t1 B DD
?re/al B 2esult
8nd *f

.urr/al B '

7peration B DHD
8nd -ub
?ri"ate -ub .omnd-ubtrA.lick)*nde, 3s *nteger)
+e,t1.+e,t B D D
?re/al B .urr/al
*f \$ot 2esult B ' +hen
+e,t1 B DD
?re/al B 2esult
8nd *f

.urr/al B '
7peration B D>D
8nd -ub
?ri"ate -ub +imer1A+imer))
*nter"al B 1'''
8nd -ub
2esult B '
8nd -ub
?ri"ate -ub mnu6lueA.lick))
Form1.6ack.olor B 2;6)'= '= 255)
8nd -ub
?ri"ate -ub mnu;reenA.lick))
Form1.6ack.olor B 2;6)'= 255= ')
8nd -ub
?ri"ate -ub mnu5a,mi1eA.lick))
Form1.Window-tate B 2
8nd -ub
?ri"ate -ub mnu5inimi1eA.lick))
Form1.Window-tate B 1
8nd -ub
?ri"ate -ub mnu\$ormalA.lick))
Form1.Window-tate B '
8nd -ub
?ri"ate -ub mnu2edA.lick))
Form1.6ack.olor B 2;6)255= '= ')
8nd -ub
&. 0sing 5<* form and four normal forms= write a program to
ma,imi1e and minimi1e all the four forms. <o this with
creating a menu. 3lso title all four forms "ertically and
?ri"ate -ub mmnu3llA.lick))
Form1.Window-tate B 2
Form2.Window-tate B 2
Form3.Window-tate B 2
Form4.Window-tate B 2
8nd -ub
?ri"ate -ub mmnuForm1A.lick))
Form1.Window-tate B 2
Form1.-how
8nd -ub
?ri"ate -ub mmnuForm2A.lick))
Form2.Window-tate B 2
Form2.-how
8nd -ub
?ri"ate -ub mmnuForm3A.lick))
Form3.Window-tate B 2
Form3.-how
8nd -ub
?ri"ate -ub mmnuForm4A.lick))
Form4.Window-tate B 2
Form4.-how
8nd -ub
?ri"ate -ub mnu3llA.lick))
Form1.Window-tate B 1
Form2.Window-tate B 1
Form3.Window-tate B 1
Form4.Window-tate B 1
8nd -ub
5<*Form1.3rrange )')
8nd -ub

?ri"ate -ub mnuForm1A.lick))
Form1.Window-tate B 1
8nd -ub
?ri"ate -ub mnuForm2A.lick))
Form2.Window-tate B 1
8nd -ub
?ri"ate -ub mnuForm3A.lick))
Form3.Window-tate B 1
8nd -ub
?ri"ate -ub mnuForm4A.lick))
Form4.Window-tate B 1
8nd -ub
?ri"ate -ub mnuIori1ontallyA.lick))
5<*Form1.3rrange )1)
8nd -ub
?ri"ate -ub mnu/erticallyA.lick))
5<*Form1.3rrange )2)
8nd -ub
?ri"ate -ub "Form1A.lick))
Form1.-how
8nd -ub
?ri"ate -ub "Form2A.lick))
Form2.-how
8nd -ub
?ri"ate -ub "Form3A.lick))
Form3.-how
8nd -ub
?ri"ate -ub Form4A.lick))
8nd -ub
?ri"ate -ub "Form4A.lick))
Form4.-how
8nd -ub
1'.<esign an 8lectronic /oting 5achine in /isual 6asic for
election for which four ?olitical ?arties namely( 6@?=
.7\$;28--= -? and 6-? are contesting
<im 6@? 3s *nteger
<im .7\$;28-- 3s *nteger
<im -? 3s *nteger
<im 6-? 3s *nteger
?ri"ate -ub .ommand1A.lick))
6@? B 6@? H 1
.ommand1.8nabled B False
.ommand2.8nabled B False
.ommand3.8nabled B False
.ommand4.8nabled B False
5sg6o, D/oted .3-+8<D= "b7F7nly= D8lectronic/oting5achineD
8nd -ub
?ri"ate -ub .ommand2A.lick))
.7\$;28-- B .7\$;28-- H 1
.ommand1.8nabled B False
.ommand2.8nabled B False
.ommand3.8nabled B False
.ommand4.8nabled B False
5sg6o, D/oted .3-+8<D= "b7F7nly= D8lectronic/oting5achineD
8nd -ub
?ri"ate -ub .ommand3A.lick))
-? B -? H 1
.ommand1.8nabled B False
.ommand2.8nabled B False
.ommand3.8nabled B False
.ommand4.8nabled B False
5sg6o, D/oted .3-+8<D= "b7F7nly= D8lectronic/oting5achineD
8nd -ub
?ri"ate -ub .ommand4A.lick))
6-? B 6-? H 1
.ommand1.8nabled B False
.ommand2.8nabled B False
.ommand3.8nabled B False
.ommand4.8nabled B False
5sg6o, D/oted .3-+8<D= "b7F7nly= D8lectronic/oting5achineD
8nd -ub
?ri"ate -ub .ommand5A.lick))
6@? B '
.7\$;28-- B '
-? B '
6-? B '
5sg6o, D3ll the <etails 8rasedD= "b7F7nly=
D8lectroni/oting5achineD
8nd -ub
?ri"ate -ub .ommandA.lick))
.ommand1.8nabled B +rue
.ommand2.8nabled B +rue
.ommand3.8nabled B +rue
.ommand4.8nabled B +rue
8nd -ub
?ri"ate -ub .ommand!A.lick))