Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 438 Weeks Ago, 1 Day Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Programming Posted 02 May 2017 My Price 7.00

Write a class Ar r a y that encapsulates an array

Write a class Ar r a y that encapsulates an array and provides bounds-checked access. The private instance variables should be i nt i nde x and i nt a r r a y[ 10] . The public members should be a default constructor and methods (signatures shown below) to provide read and write access to the array.

If the l oc a t i on is within the correct range for the array, the i ns e r t method should set that location of the array to the value. Likewise, if the l oc a t i on is within the correct range for the array, the r e t r i e ve method should return the value at that location—the approach taken by the library before Java 5.0. In either case, if l oc a t i on is not within the correct range, the method should throw an exception of class Ar r a yOut Of Bounds Exc e pt i on. Write an application that helps you test your implementation. Your application should assign values to the array by using the i ns e r t method, then use the r e t r i e ve method to read these values back from the array. It should also try calling both methods with illegal location values. Catch any exceptions thrown by placing the “illegal” calls in a t r y block with an appropriate c a t c h.

Answers

(8)
Status NEW Posted 02 May 2017 11:05 AM My Price 7.00

-----------

Attachments

file 1493726164-answer1.docx preview (355 words )
W-----------rit-----------e a----------- cl-----------ass----------- Ar----------- r -----------a y----------- th-----------at -----------enc-----------aps-----------ula-----------tes----------- an----------- ar-----------ray----------- an-----------d p-----------rov-----------ide-----------s b-----------oun-----------ds------------che-----------cke-----------d a-----------cce-----------ss.----------- Th-----------e p-----------riv-----------ate----------- in-----------sta-----------nce----------- va-----------ria-----------ble-----------s s-----------hou-----------ld -----------be -----------i n-----------t i----------- nd-----------e x----------- an-----------d i----------- nt----------- a -----------r r----------- a -----------y[ -----------10]----------- . -----------The----------- pu-----------bli-----------c m-----------emb-----------ers----------- sh-----------oul-----------d b-----------e a----------- de-----------fau-----------lt -----------con-----------str-----------uct-----------or -----------and----------- me-----------tho-----------ds -----------(si-----------gna-----------tur-----------es -----------sho-----------wn -----------bel-----------ow)----------- to----------- pr-----------ovi-----------de -----------rea-----------d a-----------nd -----------wri-----------te -----------acc-----------ess----------- to----------- th-----------e a-----------rra-----------y. ----------- -----------If -----------the----------- l -----------oc -----------a t----------- i -----------on -----------is -----------wit-----------hin----------- th-----------e c-----------orr-----------ect----------- ra-----------nge----------- fo-----------r t-----------he -----------arr-----------ay,----------- th-----------e i----------- ns----------- e -----------r t----------- me-----------tho-----------d s-----------hou-----------ld -----------set----------- th-----------at -----------loc-----------ati-----------on -----------of -----------the----------- ar-----------ray----------- to-----------
Not Rated(0)