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
How to cite a dictionary in mla 8 owl perdue?
Elan Coil [88]
<span>To cite an entry in a dictionary according to Purdue Owl MLA 8th generation, you would cite it as any other book but do not include the publisher or the volume (if arranged alphabetically. An example is: "Creation" The American Heritage Dictionary. 3rd ed., 1997.</span>
6 0
3 years ago
One of the advantages of simulation is​ that: A. it is a repetitive approach that may produce different solutions in repeated ru
Dafna1 [17]

Answer:

A. it is a repetitive approach that may produce different solutions in repeated runs.

5 0
4 years ago
Read 2 more answers
If several programs or apps are running simultaneously, your computer or device might use up its
kirill [66]

Answer: I am pretty sure it's RAM

Explanation:

I'm not 100% positive bc I haven't gotten my scores back yet but I think that's it.

7 0
3 years ago
Change 43/6 into a mixed numbers
Rina8888 [55]
7 1/6


43 goes into 6 7 times with one left over. 6x7= 42 43-42=1

7 1/6



































7 0
3 years ago
Read 2 more answers
1. INTRODUCTION In this project, you will gain experience with many of the Python elements you’ve learned so far, including func
yulyashka [42]

Answer:

See Explaination

Explanation:

def process_string(s):

global char#global varibles

char=[]

global count

count=[]

for i in s:

#checking whether i is alphabet or not

if(i.isalpha()):

#converting to lower

i=i.lower()

if i in char:

#if char already present increment count

count[char.index(i)]+=1

else:

#if char not present append it to list

char.append(i)

count.append(1)

#menu

print("1. Enter a string")

print("2. Display the string")

print("3. Reverse the string")

print("4. Append a string to the existing one")

print("5. Slice the string")

print("6. Display the number of occurences of each letter")

print("7. Quit")

op=input("Enter option:")

#as I don't know what you have covered

#I am trying to make it simple

#checking whether input is numeric or not

#you can use try except if you want

while(not op.isnumeric()):

op=input("Enter valid option:")

op=int(op)

global x

while(op!=7):

if(op==1):

x=input("Enter a string: ")

elif(op==2):

print("The string is:",x)

elif(op==3):

x=x[::-1]#reversing the string

print("The string is:",x)

elif(op==4):

y=input("Enter a string: ")

x=x+y #string concatnation

elif(op==5):

a=input("Enter first integer: ")

while(not a.isnumeric()):

a=input("Enter valid first integer: ")

a=int(a)

b=input("Enter second integer: ")

while(not b.isnumeric()):

b=input("Enter valid second integer: ")

b=int(b)

x=x[a:b]#string slicing

#you can also use x.slice(a,b)

elif(op==6):

process_string(x)

for i in range(len(char)):

print(char[i],",",count[i])

else:

#incase of invalid input

print("Invalid option")

print("1. Enter a string")

print("2. Display the string")

print("3. Reverse the string")

print("4. Append a string to the existing one")

print("5. Slice the string")

print("6. Display the number of occurences of each letter")

print("7. Quit")

op=input("Enter option:")

while(not op.isnumeric()):

op=input("Enter valid option:")

op=int(op)

6 0
3 years ago
Other questions:
  • What process does a system use to officially permit access to a file or a program CIS 502 ?
    11·1 answer
  • Jeanne writes a song, and Raul wants to perform
    6·2 answers
  • You are tasked with designing an airplane that could carry a very large load of cargo. What type of airfoil would you use for th
    13·1 answer
  • Write a function that will sum all of the numbers in a list, ignoring the non-numbers. The function should takes one parameter:
    8·1 answer
  • Design a for loop that gets 6 integer numbers from a user, accumulates the total of them, then displays the accumulated total to
    9·1 answer
  • Comments should Your answer: rephrase the code it explains in English be insightful and explain what the instruction's intention
    15·1 answer
  • Which protocol is responsible for transporting files between a client and a server?
    14·2 answers
  • In Super Mario 64, a character called Lakitu follows Mario around on a cloud, filming him with a camera as though he were shooti
    8·2 answers
  • What are the key constructs of a G&amp;T Value Delivery objective?
    6·1 answer
  • Scott sends his backups to a company that keeps them in a secure vault. What type of backup solution has he implemented?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!