Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

JAVA PROGRAMMING ASSIGNMENT 10

taylorsmallory
taylorsmallory 


Lab Assignment This lab assignment will ask you to write a program using text files. Exercise 1 1. Create a New Project named TextFileExample. 2. Declare and instantiate a two-dimensional int array called temperatures which contains four rows (corresponding to weeks) and seven columns (corresponding to days). Read the temperature data from a file called TemperatureData.txt that you will download from Blackboard. Write a nested for loop that prints out the values of the temperature data. The output will appear as follows: Temperature Data Week 1: 73 71 68 69 75 77 78 Week 2: 76 73 72 72 75 79 76 Week 3: 79 82 84 84 81 78 78 Week 4: 75 72 68 69 65 63 65 Attachments Tags
Clarifications

Answers

Java - Temperature Data - Solution

dickersonka
dickersonka 



Attached is the solution to the Java - Temperature Data assignment including source and comments Attachments
TemperatureFileReader.zip (1 K) Download
Preview
System.out.println("Failed to open file TemperatureData.txt"); } //create 2d array int[][] temps = new int[4][7]; //loop through weeks for(int week = 0; week < temps.length; week++){ //loop through days for(int day = 0; day<temps[week].length; day++){ //set value in

Preview
76 79 82 84 84 81 78 78

Screenshots
Purchase Answer

JAVA PROGRAMMING ASSIGNMENT 10 - Solution

mariobeka
mariobeka 



Below you will find the solution for you assignment. Comments are provided as well. Attachments
TextFileExample.java (1 K) Download Preview
= new FileReader(filename); BufferedReader reads = new BufferedReader(readConnectionToFile); Scanner scan = new Scanner(reads); // Declare and instantiate the array int[][] temperatures = new int[4][7]; int counter = 0; try { // Iterate through the file and read the temperatures; while (scan.hasNext() && counter < 5) { for (int i

TemperatureData.txt (1 K) Download
Screen Shot 2014-04-29 at 12.31.40 AM.png (22 K) Download Preview

Screenshots
Screenshot
Purchase Answer