0% found this document useful (0 votes)
6 views14 pages

Array Imp Programs

The document contains Java programming code snippets for various tasks including finding the largest and smallest numbers in an array, calculating the sum of array elements, and storing student names and marks. It also includes examples of searching for names and telephone numbers using linear and binary search techniques. Additionally, there are variable descriptive tables that explain the purpose of different variables used in the code.

Uploaded by

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

Array Imp Programs

The document contains Java programming code snippets for various tasks including finding the largest and smallest numbers in an array, calculating the sum of array elements, and storing student names and marks. It also includes examples of searching for names and telephone numbers using linear and binary search techniques. Additionally, there are variable descriptive tables that explain the purpose of different variables used in the code.

Uploaded by

20s41a6603
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
fray | iahite_a OG ram chat Creates ‘an trleger ar Rene cep Value for Aeag lernene ‘fro the tues and dlisplay ‘the values . ~nport jovaretel 5 4 v ____ public class “Highest ; i SEESESSTEE=nansrnemenssenaneet “Sher ne oo _public_static void mate ( String args CI) throws To Exe. Pee - ; = — _Sconner Sin = new Scanner (System. to ) jot Py man zoe a Stying mE]: new Shing Lae], String Pe _—_— ink nm Es new nt [ao}y. =O; ica. i++) @ scanned with OKEN Scanner ' or (i=05 ‘cao; is) “yf ony? ma) ea Cid, pore 4 3 1 VARIABLE DESCRIPTIVE TABLE VARIABLE NANE DATR TYPE DESCRIPTION 5 ‘ink . 4g:tun the loop 2° dimes int = fe Stove the bight value Sting» fp stove 2 nawre to the array _ ue Bring stove a0 numbers fo the _ array. seo pagan b Tope and love wll narabes, ms and marks te 3 subjecks of 9 number 0} studen’ tn -—|5_single Dimensional’ array qnd old play. the _vemmsk based @ scanned with OKEN Scanner ____ Excellent Dis Bat ahi Pass Poor Import java-util-*; Public class Remark £ | public static void main (String songs fi) $ Séanner tn = new Scanner (System: in) Int Peon, | double avq=o- Systern outs 'printtn (“Enter number of Sturdenis "), 0 = Ine nent Mut (), te String name’ TI new Sty trg En]; int V0] = new int Ln], “t a] cfokmT] = pew tot [r], int mal] new tot [oJ], fok Ma L1= new int [py, for(ts On iems i+) System-out-println (Gdev seltna™ Jy MC Eler volley) @ scanned with OKEN Scanner a lil: tosnedt Dat 05, Sen out :printte (° Enter oame")s fecnest Oy, Bet ™ enext Pat Uy © mg Ti] = ins next intl), He Petrik fi i — Balen out: printin (* Roll No \t Name \t Remarks), — liso; tens t+) : : ais avg (mC11+ mms Li] + ms C03), if (avg? = Ss &§% ayg< = 100): System: oub-petits_| (a LiJa Ve"4 pare C114 Ce ses _ Rxcettent)s yee as $8 a bern: oul: pri itln ( ail am nae 2 =4s) bet Systenssouts priate (CLs "IE! Naname [11 +1b"s Fast class): i _7 = ho 8B avg «= 54) : ystern out: ae (aLiJa Ub" + dame tia We Pass); eee eee eee : bts name CHL + SYR" Diskenction); HE area 7 a she: bub: prt eI poem) @ scanned with OKEN Scanner LVoviable Name Datta type oi Descriptio! ca int 4 loop variable : A = a Number s} Stunderity a U | a%g double te slore_avernge Marks i name £1 String fo Contain mare ‘of, the i af HAH uit tut "\shidentts unt xO ] mC i i i malt | ; i] gL] ink fe contain may ks o J thd Write a Program te store _bubjeck- aod _u’ elemenk ta an ati @ elements In an arndy P Q 3rd arsay R containi Tay Q ard Progretmot produce _| f P avd Q Doplay the ves galt the elements o p array tltant-arvay a eee @ scanned with OKEN Scanner | impart cub , : ' clous Merge & ue . : a a. i PL = new | aot Cel; mt REITs new tot a] *)oltier ) nin jot To SS tot tj i (wid display 0 throws To Excephion t : 7 Scannes SC = New Scanner System: To); _ for fizo, tee; tet) — t gt : System out» vinta ("Enter a oumber"); | | Phi] = PLiJ = sc-#next Int (); — = Dh isis i: : i pr lise: iews tee) f bis i —_ Sushemvouk println (“Enter a * ie . @r-or QLI= se- next Tat); iseijem pees) @ scanned with OKEN Scanner UT: Qt = 5 pee lov (iz 0» iztos i++) | System: oul: priatle (@ bid); } 4 VARIABLE DescelPrive TABLE VARIABLE NAME PATA TYPE DESCRIPTION Pry nt to store faxst area Qtl ink to store Second avo eel ink to store Merged avroy i ("usd int : loop variable J singe, loop variate +| Write G_ program to store a0 different fares alon: corresponding telephone number. Enter a name | Console and search w not - RR the Name u A Pare along with +the hone Number, otherwete despla and oppephals Message using linear search techni @ scanned with OKEN Scanner i import java vuhil.* I ni class Name Telphone [ois we ng ag aoe in = new Scanner (System: in) (ink ipa: hy “ke; 420% | String che, b=” "; \ Shing “mL: New String Lao] y ink nL] = new ink eS | for 0; (220; tt) Syste: oul: printh [* Cater the name in cell # One by one “) | pi = next 0); Sat System ou: lem oic- priate (" Enk Enter: telephone_no_in wall and by one. 2, | oe Lh lids ets next dnt (). System: aud print [" bnter she name to be searched", ths in: next LD : , t—§ Paige (420; viet) = — as (mfil. equals (ch), : 7 [ ke ai by med ic . _ @ scanned with OKEN Scanner i$ Bi (ws+4) ———__ System outs Priotln (“the name i "+bt" and 4, __ telephone number & "+n [a7] prt (“cht "G_nok found abany a location), 3 : _| ona 4 : uv ‘ i] i | VARIABLE DESCRIPTIVE TABLE = —— ; VARIABLE WAME DATATYPE’ | DesceipTION) t int Gi. loop variable ania int _b store felphone Aunber k ink i $b shore the count of eds \ fo Shore nae 1 ns ava @ scanned with OKEN Scanner : write a proget tn java lo slore 40 differert 5 ope ingle dimensional Arvay (spn)and Search whether o : puraber ¥ gives by Using binary Search tec bnyee- a. number hee then dis play the mestage * Search Suef | Fperwie ‘Number is ot_ presen” import [Link]"; { public ctass_Binary—Seare TT a [ 7 ghatic vold main (String orgs i. att + feaqaer te 2 new Seamer (System) a int ty db, ub, pr kins : nae ng 20; kK 205 tb=0; ub=0, p 20> L Tot em C1 = dee MELOY new tot fol, r ito feo} fat) ee ee 1S stetniout: paitln(®Enes the no fo be sfernched “): ‘os = insnext Det) : (tbe=ub)_ >= (Abou) fa, -1f Go [Pe ns) : a r = Gorey es) ~ ee @ scanned with OKEN Scanner A Cetrdes rs) | kel; i break 5 oo 4 : a 5 Pdi | if (k= =) 4 System out Pratl (“Th The Search is ‘Succes ul wl"), else Sle ot pal The Search u-@ un Successful) 3 oo Varingie DESCRIPTIVE TABLE VARIABLE NAW ornare “i? . Descerenvé Te 2 oy Soop Variable ip ils fo shre> Lower bond int to_store tppa_bend _ Nida d @ scanned with OKEN Scanner

You might also like