0% found this document useful (0 votes)
9 views

Visual Prog Assignment

Uploaded by

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

Visual Prog Assignment

Uploaded by

vamebov828
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

L VIsUAL PRonRA MMING]

1 Wite a peogtane to Perfom au'hmet'c


Opeeion in
cale
private vold btn(alcutate- Click (object cendet,

double numl lon vet. To Double ( txt Num1. 7Text );


double num2 = (orueut. To bouuble (txt Num2.7ext);
ciuing opuahon = cabopeueation. selectd ltem. ToSuig t)
doubie
switcs (opuaion)
Cale : Add
ruult = num14nn2;
bLeaj
cue:"SUbtuact":
result num1-nm2j
bueaej
Cuse :"Nultipy:
relull = nwm 1* num 2;

ailcae: "pivide':
relult - mum1/num 2;
bueau;

default: Show ("select a valid apuahioo ;


Mutaqubor .

Lbotult.Tert "kelut,"rut.To Cthuing(0;


2] Pefine a class "caluy wj'ch will tontajn
munbu vewabled Bayie , TA,DA, HRA. Wuite a
Pkogam uig Contutes wh depeult vales fen

clet Salau
double Baic, TA,DA, HR4:
pubu'e
double da-f00,
pbe (alauy (double baic ,double ta,double hra= 20 )

Byic= balic;
TA = ta;
DA da;
HRA= ha;

doublo Calulete aleuy () = Basic +7At DA+HRM


public
sfaic void Main ()
alouy (3000 5oo);
Corole .Wu'e Line ("Total Salauy :'+ sal, calauiate
alay ();
S| D24 ign a sign-up fo, m validate wuer phone
no with eractly to digit and fmail lD.
wing Cycdem;
using syctem.Test.RaguouExpuakionu;
clays Sign Up f
pbie static bool Validak Phone (stuig phone)
pub'e ctatic bool Valdat Email | stuug emai)
’Reger I: MaBch (emai,"A[Nw.-JieNwJ
l .e-ZA-Z] (2,4})
cfatic void Main ()S
Conole wutelino ("Phont vau'd:+
Va'date Phono ("987654 3210);
Coole Wwteline ("Email valUd:"4
eidate Email ("ttDeyanple tom));
4|Deyion a cign-up tom ? veidate yone(nuinian
B choa ctecs maxin l5 end onty cheeceh)
pauiw dand etye pal wo (boh chould be cne).

publie tate bol Valideke Uhenane (ttwig usnyre)

pubie cat bool Validaielakwnd (uing pasuad,


stuing tontimfotuwd)
sfatc leid Main ()

Val'date Ukenene ("Tohn Doe l23;


CoNole Wheitelinel" Paltwond vd :'4
5 Duign a cab appu'caten form hauig loan
amOt,jtucst rate ud durhen ieldd.
Calculate the Siuple
lntuest and pufom
nuasau valdetHon ie, Enlwnes deta hes
been outued fo each fild .Che ig fen
hon- nume'e aluel.

e puvat vold btn(aletate-Ciek (object senden,

t (doubo .Tuy Poce (txf Loan Anaunt. Toxt,


out double Peu'ncipl) 44
it Tuy Pase (txt Loan Duratien-Text,out int Hne)

doub le intuet =(puincipol t rate t tine)/l0;


tbL Rosutt. Text "si= " ituut.70Sung (J;
?

w'th nic value");


6.| («eafe he apu cafon that acepts nent, PatUmd,
age, email id d weu id. A the
infamahian enay is conpulsaey,fouuod hetd
be' uconfmed: Age sheuld br wikoin 21 to Bo.
Emait id akordd bo oid. Uss id shaud ave
atieeyt a copital lutu and a aiçit au welt au
longth ckould be butwen 7and 2o cha eiues.

puivate oid btn Subrit CUck (obhece sender,


Eveathgs e)
Stuing ptood trPutwed Text
int age =int. Pavse(ttt Text).
eMal = toEmall.Tert;
stuiag uuenLd = tt sar lD.Tet;

Mwqebox khoa ( "Rgistuain cucsaful");

MeugeBo hoo ('Vew'dahon fuled ');


DegtlD a twployed fusm the deebal
Wig sL sorle cotuol and bind it to Grt V,ew.
Dalabaue inds aut (Dept D, bpt Nene, uplena, atay)

uiy Cql Cornechen


Connectoen Con= nw
(conne ctenSu g))

sqlbata hdeptu da = nuw GlDatahaptw ("ELEcr


Deptto,bapt None, ExpNara, ala FRoN
Euployees ", Con);
bata Table dt neuw DateTable ():
cla .Fill (at);
Gyid Vieo 1"Data Sole =dt;
Gutd Viuwl. Data Bid )
tulcetuly'; added "Uen 7ert MUsage. L
(J; Qay Non Execut CMd.
(); bpen con.
.paued); leuod (@
Value Nih Add etut. laarm Cd.
wpane) OUcuraeo PaarMLtUs.Adt
aue( Wih Cnet.
(tuuy,
):con qlonnand new sqllowmand
crd=
Pesur Ueunaa
0 Vatues Pas
(@sso) (Usenan,
e s UcINTO"NCERT quey gstu
Stu))
igConnectoy
stug; etio4 (oHn 'your Sjy= chon conne Suig
.ed; faauod pawod
rt =
.Texf:txtUSeunam e unane = sting
e)
hugs Eveat
cendu, (object
Aadvsyick bèn yold cted Custe
pjnay
key thoutd
be detabase
the senar
in databas. thPautd
e in
vseuare adds wkic Mlule Lgin Cuate
a 8.
he S4l data bave table hawig folowit ield
(Dept lD, bept Nane ,Enphlu, lalauy) . Utete he
to b, le puueut calauy. Pefom delete
table
he aafabaye

pueteete vold bin Pures Cicklobject nd,


tvths e)
Stuly connutton g yowrconne thon -shuY
usag (ylonneciaa on = nuw Sq llonnehen
Connectte tug
Con. open l);
IlInked re covdu
Sal tommand inceutbnd =nusgl lonend|"wSERT
INTO EMployu (Depitb, DgtNone, EupNna, Calouy)
VALUES (I,'HR, Totn50000),(2 7, "Jana', 60c00),
(3,'talei',"Bos ,55o00);con);
in tont nd-Ex ecwt Non Quey U;
Sal onmenel updutlnd= nuo Sqllonemand ("vpDATE
Enployes SETJateuy=Saauy.15 wHERE
EpNnue:'Tane". con): upd ake nd. Ereute Nen Queyl) ;
Sqlonuand deletelnd= new sgl lonnud( ' DELETE FRo
Enployees WERE CnpNane- Bob'",con);
duetelud.Exeeute Non Quey (0
?
tbLMsage. Tert = "Reconal puocened ";
I6. Cueate a web appu'atien to velidate he aboe
data ike Dept Naue Is Tquiu, salany
Myt cotn onty nUben, EmpNaue cet ae
put ofke lhan a- a space uig vatdajoy
tools o Acp. NE7.

<asp :Requtedfieldlalidator lb- "fv DeptNane


runat "euve" Cordel To Validate= "tx+ Dept Nane Y
Errr Meuae
Zaup: Tet Box. Ip= "txt lalany qunat -swe"s

ruat smwe CondalTo Vatdatt-"txt aleg


Vaidatbafx pattion ="^\d+f" Erm Moksage ='alauy
Must be nuneic /
<aup: Test box D= txt EnpNanu ruatsenwen
Cap: Ryulo fxpubon Valtidat,0revfupNeue Nauue"
run "Suwe" oduslTo Vadake ="txt Enp

ErTo Mlg e= 'EnpNne neut condain only


11. Pythan puguan to find he cum and avmage

impout sys

Ust-pud (t loat(n))
tot = cum (ist)
pint (To tal =, tot)
awg = tot (len (lst)
puint ('Aveage= ', ag)
12 Pytton fuaguarn hat isplayc tas in igt
angled tuiengulon fom uing nelted lops
(in uge (1,6):
fo j in range (1,1):
pnt ( ) n k
23} Fython pusguarm to wwt a funchn
that uny the 4Ult sUM
det sum(a, b) :
Telun atb
ed = sn(5,10)
puRt ('The Tuttis,)
14
Pythan pusgMam to peufsm sOMe nehonahcal

fuom nuy inpot


auH auay(LI0, 20, 90.5, -40])
puiat ("owginal auay:",au)
puit ( "Add 5:", ao t5)
puint (" subtuact 5:", ar45)
pint ("Multipy5:, an*5)
Putat (bìvide by 5:", au 6)

puat Expuest lon value :", (ava+5]**2-10)


puint "sin vatuui ',Sinlan)
pudut Cos valul: coc (aus ))
puiut Tan valu:", tan (aue))
" Biggut alement: ,Mar (au)
puiut euent:", n(avs ))
puiut Saiallel t
pulut( all elenenh: ,MeUN a))
a chident cas coih
itane nethods o pwtees the data
Swyel ctudut.
clay Student!
def init (elf,n=,n=0)
slf nme = n
Self mrus = m
df di'splay (4):
puut ('H',self:nan)
puw't' youy meus ,slf-Manka)
det calculate (sel):
It (self Mouly s=600):
pu'ut ('iut fate y
eif (celf -marli = 500):
pait ('kecond pade')
ellt (suf "aulu s =360):
puiut ( 1Taiud qade)
lse:
puiat ('Faited )

i'le lien):
iuput ('Entu nane :')
s= Shudeut (name,Ma_ke)
s displag )

You might also like