1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Makovka662 [10]
3 years ago
11

Write a program to read data from a file named problem 2. ext. This file has three exams data (floating point data) in three col

umns for the students in a class. Find the average and the highest score in the class for the Second exam which is located in the Second column of the file. Assume that the file has neither initial number of total lines of data values nor any sentinel signals. That is your program need to show that you have no idea how many data lines are there) 77 90 86 66.5 88 80.5 95 75 80 80 79 89 70.5 81 Note: If you don't have the software access then you don't have to worry about saving the data file. Just write your code assuming the text file is saved in the right location.
Computers and Technology
1 answer:
Travka [436]3 years ago
6 0

Answer:

import java.io.File;  // Import the File class

import java.io.FileNotFoundException;  // Import this class to handle errors

import java.util.Scanner; // Import the Scanner class to read text files

public class ReadFile {

 public static void main(String[] args) {

   try {

     File myObj = new File("filename.txt");

     Scanner myReader = new Scanner(myObj);

     while (myReader.hasNextLine()) {

       String data = myReader.nextLine();

       System.out.println(data);

     }

     myReader.close();

   } catch (FileNotFoundException e) {

     System.out.println("An error occurred.");

     e.printStackTrace();

   }

 }

}

Explanation:

this will read the file and print it out, to do the rest have it take the data and use some "java math" and then print the answers to either console or a file of your choice.

You might be interested in
What would a match() property that passed the expression /^[0-9]/ check for?
lord [1]

Answer:

E

Explanation:

I took the test

7 0
3 years ago
Read 2 more answers
Please help. 10 points
pickupchik [31]

Answer:

God Is Good He Will Always Help You He Is Good And Always Good!!

If God Is For Us Who Can Be Against us?? Romans 8:31

Explanation:

6 0
3 years ago
Read 2 more answers
A browser is an example of a<br>​
Inessa [10]

Answer:

User Interface, Website

3 0
3 years ago
Any song recommendations, pls dont say 6ix9ine or lil pump
gogolik [260]

I actually do have one tho. Try Megan Tha Stallion.

8 0
3 years ago
Read 2 more answers
What natural resources products are discussed in the article? Are they renewable or nonrenewable?
Alex

Where is the article

4 0
3 years ago
Read 2 more answers
Other questions:
  • Exposing employee and customer personal data to an untrusted environment is an example of:
    9·1 answer
  • What operator is used to create a validation rule? A. – B. / C. &lt; or &gt; D. +
    12·1 answer
  • An icon in a document preset that looks like the play button on a YT video, what type of document is the preset meant to be used
    13·2 answers
  • In addition to training on the products and on company policy, it does not make sense to be prepared to speak about your company
    6·2 answers
  • The number of bits that can be transferred per second over a given transmission medium.
    6·1 answer
  • What are the three primary separation of concerns on the client-side of a dynamic web application? (Check all that apply)
    13·1 answer
  • What are the benefits of using an ordered list vs. an unordered list? What are the costs?
    10·1 answer
  • PLEASE HELP!! WILL MARK BRAINLIEST!!
    9·1 answer
  • When you start a new blank document, you begin typing at the
    6·1 answer
  • Which of the following are the most important reasons people in the 1920s were so interested in seeing lifelike stories in audio
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!