首页 > > 详细

代写System留学生作业、代做Java程序语言作业、代写Java实验作业、StringToIntArray作业代做代写留学生Prolog|帮做Haskell

Assignment Steps: 
1.The only time the Arrays class may be referenced in your code is in the import statement and when using the fill method to populate the entire array with Integer.MIN_VALUE. 
2.Create a Java class named StringToIntArray. 
a.Properties: 
i.intArray: a private array of 10 integer values 
b.Methods: 
i.public StringToIntArray(): a no-args constructor that uses the static fill method of the java.util.Arrays class to populate every element of intArray with the constant value Integer.MIN_VALUE. If an element contains Integer.MIN_VALUE, you may consider it to be “empty”. 
ii.public int indexOf(int intToFind): loops through intArray to find the value intToFind. If found, returns the index of the element containing intToFind, otherwise returns the value 
-1 to indicate the value is not in intArray. (Note: -1 will never be the valid index of an array element as array index starts from 0). 
iii.public int indexOf(String intToFind): If intToFind is contained in intArray, returns the index of the element containing the value, otherwise returns the value -1.
 Note: intToFind must be converted from a String to an integer in order to search. 
iv.public boolean contains(int intToFind): Returns true if intToFind is in intArray, otherwise returns false. 
v.public boolean contains(String intToFind): Returns true if intToFind is in intArray, otherwise returns false. 
vi.public int get(int index): if the index provided is invalid (out of bounds for intArray), return Integer.MIN_VALUE. Otherwise, return the value of the element of intArray at the requested index. 
vii.public boolean scanStringToIntArray(String s, boolean skipErrors):  
1.Declare a local Scanner variable, using the String s as a parameter to the Scanner constructor (instead of System.in).  
2.While the hasNext() method of the Scanner returns true, if the next value in the Scanner contains an integer put it in the intArray.  
a.Use the hasNextInt() method of the Scanner to validate the presence of an integer, and the nextInt()method of the Scanner to read in the value.  
3.If skipErrors is false, if any values are encountered in the String s which are not integers, intArray should remain (or be returned to) an array of 10 elements of Integer.MIN_VALUE and false should be returned.  
4.If skipErrors is true, if any values encountered in the String s which are not integers, the non-integer value should simply be skipped over and intArray continue populating with the next String value.  
5.Hint: If a value is not an integer, don’t forget to read and discard the value using the next() method of the Scanner. 

3.Your assignment is to be submitted on Brightspace as Java files. It should be submitted with the following guidelines: 
a.Include the file header using the template provided in every java file submitted. 
b.Follow expected style guidelines: 
i.Use “Egyptian” style braces for all classes and methods. 
ii.Indent your code using 4 spaces (no tabs). 
iii.Follow naming conventions for all class, variable, and method identifiers. 
iv.Use appropriate whitespace for readability. 
v.Comment your code (no less than one comment per class, and one per method). 
c.File must be named StringToIntArray.java. 
d.Method names, return types, and parameters must match those in the requirements above. 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点文章
程序代写更多图片

联系我们 - QQ: 99515681 微信:codinghelp
© 2014 www.7daixie.com
程序代写网!