首页 新闻 聚焦 科技 财经 创业 综合 图片 视频

IT界

旗下栏目: 行业 生态 IT界 创新

代写System留学生作业、代做Java程序

来源:珠穆朗玛网 发布时间:2019-11-27

代写System留学生作业、代做Java程序语言作业、代写Java实验作业、StringToIntArray作业代做
Assignment Steps:
1.The only time theArraysclass may be referenced in your code is in theimportstatementand when using thefillmethod to populate the entire array withInteger.MIN_VALUE.
2.Createa Java class namedStringToIntArray.
a.Properties:
i.intArray:a private array of 10 integer values
b.Methods:
i.publicStringToIntArray():a no-argsconstructor that uses the staticfillmethod of thejava.util.Arraysclass to populate every element ofintArraywith the constant valueInteger.MIN_VALUE. If an element containsInteger.MIN_VALUE, you may consider it to be “empty”.
ii.public intindexOf(intintToFind):loops throughintArrayto find the valueintToFind. If found, returns the index of the element containingintToFind, otherwise returns the value
-1to indicate the value is not inintArray. (Note:-1will never be the valid index of an array element as array index starts from 0).
iii.public intindexOf(StringintToFind):IfintToFindis contained inintArray, returns the index of the elementcontaining the value, otherwise returns the value -1.
Note:intToFindmust be converted from a String to an integer in order to search.
iv.publicbooleancontains(intintToFind):ReturnstrueifintToFindis inintArray, otherwise returnsfalse.
v.publicbooleancontains(StringintToFind):ReturnstrueifintToFindis inintArray, otherwise returnsfalse.
vi.public intget(intindex):if theindexprovidedis invalid(out of bounds forintArray), returnInteger.MIN_VALUE. Otherwise, return the value of the element ofintArrayat the requestedindex.
vii.public booleanscanStringToIntArray(String s,booleanskipErrors):
1.Declare a localScannervariable, using theString sas a parameter to theScannerconstructor (instead of System.in).
2.WhilethehasNext()method of theScannerreturnstrue, if the nextvalue in theScannercontains an integer put it in theintArray.
a.Use thehasNextInt()method of theScannerto validate the presence of an integer, and thenextInt()method of theScannerto read in the value.
3.IfskipErrorsisfalse, if any values are encountered in theString swhichare not integers,intArrayshould remain (or be returned to) an array of 10 elements ofInteger.MIN_VALUEandfalseshould be returned.
4.IfskipErrorsistrue,if any values encountered in theString swhich are not integers, the non-integer value should simply be skippedover andintArraycontinue populating with the nextStringvalue.
5.Hint:If a value is not an integer,don’t forget toread and discard the valueusing thenext()methodof the Scanner.

3.Your assignment is to be submittedonBrightspaceas Java files.It should be submitted with the following guidelines:
a.Include the file header using the template providedin 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 namedStringToIntArray.java.
d.Method names, return types, and parametersmust match those in the requirements above.

因为专业,所以值得信赖。如有需要,请加QQ:99515681或邮箱:99515681@qq.com 微信:codehelp

责任编辑:珠穆朗玛网