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
You need to prevent the use of tftp through your firewall. which port would you block?
xz_007 [3.2K]
Hello <span>Huber5598 </span>


Question: <span>You need to prevent the use of tftp through your firewall. which port would you block?
</span><span>
Answer: You should block UDP port 69 to block TFTP


I Hope This Helps You :-)
-Chris</span>
4 0
2 years ago
What would a good digital citizen do in the following situation? Nick sees that his classmate left her email account open on a s
Inessa [10]
1234567898765432123456789876543212345678987654321
3 0
3 years ago
Explain how to number text in a document​
uranmaximum [27]

Answer:

Lol

Explanation:

Yes iri

8 0
3 years ago
Read 2 more answers
Suppose that the format for license plates in a certain state is two letters followed by four numbers. (a) How many different pl
Ymorist [56]

Answer:

(a) 6,760,000 plates

(b) 3,407,040 plates

(c) 6,084,000 plates

Explanation:

The very first thing to note about this question is the number of characters involved in the license plate format (6 characters in this case; 2 letters and 4 numbers). The letters come first and then the numbers follow.

There are a total of 26 possible letters (A-Z) and 10 possible numbers (0 - 9) that can be chosen. We can then proceed to the first question;

(a) Here, the total number of possible plates is to be determined. This is done as follows:

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

Character 3 (number): There are 10 possible numbers

Character 4 (number): There are 10 possible numbers

Character 5 (number): There are 10 possible numbers

Character 6 (number): There are 10 possible numbers

So, total number of different plates will be obtained by multiplying all the possibilities: 26 × 26 × 10 × 10 × 10 × 10 = 6,760,000 plates

(b) This second part puts a constraint on the usage of the numbers, unlike the question (a), where there was no constraint at all.

Since there is no constraint on the letters, we can write that:

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

For the first number as well, we can write:

Character 3 (number): There are 10 possible numbers

However, for the remaining characters, the possibilities will continually reduce by a value of 1, since we can not use a number that has been used before. So,

Character 4 (number): There are 9 possible numbers

Character 5 (number): There are 8 possible numbers

Character 6 (number): There are 7 possible numbers

So, total number of different plates will be: 26 × 26 × 10 × 9 × 8 × 7 = 3,407,040 plates

(c) Here, repetitions are allowed as in questions (a), but there can not be four zeros. This implies that the maximum number of zeros in any plate will be three. Thus, there will be maximum possibilities on all characters until the last one which will be constrained.

Character 1 (Letter): There are 26 possible letters

Character 2 (Letter): There are 26 possible letters

Character 3 (number): There are 10 possible numbers

Character 4 (number): There are 10 possible numbers

Character 5 (number): There are 10 possible numbers

Character 6 (number): There are 9 possible numbers

Total number of plates will therefore be: 26 × 26 × 10 × 10 × 10 × 9 = 6,084,000 plates.

7 0
3 years ago
What computer worm was used to sabatoge iran's nuclear program?
Stels [109]
Researches at symantec have uncovered a version of the stuxnet computer virus that was used to attack irans nuclear program in November.
4 0
3 years ago
Other questions:
  • You're working at a large industrial plant and notice a tag similar to the one shown in the figure above. Which of the following
    5·1 answer
  • Format Painter cannot be used to copy only character attributes. True or False
    12·1 answer
  • Google Slides saves your work to Google Drive. PowerPoint has the option to save to OneDrive. Both of these solutions are in the
    9·1 answer
  • Scavenging is a form of fraud in which the perpetrator uses a computer program to search for key terms in a database and then st
    14·1 answer
  • Which of the following code displays the area of a circle if the radius is positive. a. if (radius != 0) System.out.println(radi
    11·1 answer
  • What laptop is the best for programming and hacking​
    5·1 answer
  • Write a program that prompts the user to enter an oligonucleotide sequence, such as TATGAGCCCGTA.
    7·1 answer
  • Explain the history of computing device of mechanical era
    7·1 answer
  • Which of the following describes a recording scout's job in the music industry?
    5·2 answers
  • Which tools can help you gather information about the processes running on a windows operating system?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!