{"id":5233,"date":"2014-03-30T19:58:43","date_gmt":"2014-03-30T19:58:43","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/loading-an-array-from-a-file-collection-of-common-programming-errors\/"},"modified":"2014-03-30T19:58:43","modified_gmt":"2014-03-30T19:58:43","slug":"loading-an-array-from-a-file-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/loading-an-array-from-a-file-collection-of-common-programming-errors\/","title":{"rendered":"Loading an Array from a File-Collection of common programming errors"},"content":{"rendered":"<p>I am working on an assignment with the following instructions,<\/p>\n<p>Write a method that will load an array of floating point numbers from a file named floats.txt that you create, and then return that array. Assume the first value in the file holds the size of the array. Be sure to call your method.<\/p>\n<p>I have created the following file with the title floats.txt<\/p>\n<pre><code>5\n  4.3\n  2.4\n  4.2\n  1.5\n  7.3\n<\/code><\/pre>\n<p>I have never written a method that will return an array, nor have I ever created an array that reads from a file. Not asking anyone to write the program for me, by any means, but would appreciate some suggestions to get me started. I have written the method header as follows,<\/p>\n<pre><code>  public static double[] floatingFile() throws IOException {\n  Scanner fin = new Scanner(new File\"floats.txt\");\n<\/code><\/pre>\n<p>Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am working on an assignment with the following instructions, Write a method that will load an array of floating point numbers from a file named floats.txt that you create, and then return that array. Assume the first value in the file holds the size of the array. Be sure to call your method. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5233","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5233"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5233\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}