Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Cs Array

Cs Array

Ratings: (0)|Views: 2|Likes:
Published by David W.

More info:

Categories:Types, School Work
Published by: David W. on Mar 12, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

04/22/2014

pdf

text

original

 
// David Willmore Period 7 public classCSArray {private double[] myArr;  private intmyLength;  publicCSArray (){myLength = 0;myArr =new double[myLength]; } publicCSArray (double[]joe) {myArr =new double[joe.length];  for(inti = 0; i < joe.length; i++) myArr[i] = joe[i];} publicString toString(){String ans="[ "; for(inti = 0; i < myArr.length; i++) ans += myArr[i]+", ";ans += myArr[myArr.length-1]+" ]"; returnans;} publicCSArray subArray(intindex) { intnewLength = myArr.length-index; double[]sub =new double[newLength];  for(inti = 0; i < newLength; i++) sub[i] = myArr[i+index];CSArray ans =newCSArray(sub); returnans;} public intindexOf(doubleitem) { intindex = -1; intk = 0; booleanfound =false;  while(k < myArr.length && !found){ if(myArr[k] == item){index = k;found =true;} elsek++;} returnindex;} public booleanisEmpty () { returnmyArr.length == 0;}}

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->