in java by using the loop
If your input file contains:
20
Ali Al-Shikeli 21 18
Noora Al-Wardi 22 14
Aisha Al-Rabani 24 26
Ruqaya Al-Moqbali 20 28
Karima Al-Rawas 23 20
Manal Al-Siyabi 18 28
Khalsa Al-Sariri 28 29
Iman Al-Zadjali 25 29
Farha Al-Waheibi 20 27
Amel Muqabal 21 20
Munira Alabri 20 28
Amel Khamis 21 13
Huda Al-Mukheini 23 23
Nawal Al-Shikeili 25 29
Rasha Al-Raidan 20 28
Saif Al-Hashmi 22 26
Mohamed Al-Kharousi 26.5 21.5
Mohammed Al-Badi 19 25
Ibrahim Al-Mamari 25 15
Ishaq Al-malki 29 19
Then your output should look like:
Student Name Mark1 Mark2 Avg. Mark Grade
--------------------------------------------------------------------------------------------------------------------
Ali Al-Shikeli 21.00 18.00 19.50 D
Noorai Al-Wardi 22.00 14.00 18.00 D
Aisha Al-Rabani 24.00 26.00 25.00 B
--------------------- ------ ------ ------ --
--------------------- ------ ------ ------ --
Ishaq Al-malki 29.00 19.00 24.00 B
The Maximum average mark is: 28.50 Scored by : Khalsa Al-Sariri
The minimum average mark is: 17.00 Scored by : Amel Khamis
The average of the class: 22.98
The Grade of the class: C
Assign grades as follows: A: [27-30], B:[24-27[, C:[21-24[, D:[18-21[, F[0-18[
import java.io.*;
import java.util.*;
class Demo
{
public static void main(String agrs[]) throws Exception
{
FileReader fr=new FileReader("F:\\Haritha\\hw2.dat");
File nf=new File("F:\\Haritha\\hw2out");
FileWriter fw=new FileWriter(nf);
BufferedWriter bw=new BufferedWriter(fw);
Scanner sc=new Scanner(fr);
sc.nextLine();
bw.write("\nName \t Mark1 \t Mark2 \t Average \t Grade");
float min=0;
String mins="";
String maxs="";
float max=0;
while(sc.hasNextLine())
{
String line=sc.nextLine();
String cols[]=line.split(" ");
String m1=cols[2];
String m2=cols[3];
float a=Float.valueOf(m1);
float b=Float.valueOf(m2);
float per=(a+b)/2;
if(per<min)
min=per;
if(per>max)
max=per;
String avg=String.valueOf(per);
mins=String.valueOf(min);
maxs=String.valueOf(max);
String grd;
if(per>=27 && per<30)
grd="A";
else if(per>=24 && per<27)
grd="B";
else if(per>=21 && per<24)
grd="C";
else if(per>=18 && per<21)
grd="D";
else grd="F";
StringBuffer sb=new StringBuffer();
sb.append(cols[0]);
sb.append("\t");
sb.append(cols[1]);
sb.append("\t");
sb.append(cols[2]);
sb.append("\t");
sb.append(cols[3]);
sb.append("\t");
sb.append(avg);
sb.append("\t");
sb.append(grd);
String record=sb.toString();
bw.write(record);
bw.newLine();
}
bw.write("The Minimum average mark is:");
bw.write(mins);
bw.write("The Maximum average mark is:");
bw.write(maxs);
bw.newLine();
}
}
in java by using the loop Write a program that finds all students who score the...
codeblock c++ language Write a program that reads students test scores in the range 0-200 from a file until end of file (use e of() to check if ifstream reaches the End of File Stream) and store those scores in an array. It should then determine the number of students having scores in each of the following ranges: 0-24, 25-49, 50-74, 75-99, 100- 124, 125–149, 150-174, and 175–200. Finally, the program outputs the total number of students, each score range...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...
using java Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...
Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...
Must be written in JAVA Code Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The following shows part of a typical...
Write a C++ program to store and update students' academic records in a binary search tree. Each record (node) in the binary search tree should contain the following information fields: 1) Student name - the key field (string); 2) Credits attempted (integer); 3) Credits earned (integer); 4) Grade point average - GPA (real). All student information is to be read from a text file. Each record in the file represents the grade information on...
Therefore, for this program you will read the data in the file named weatherdata_2.txt into arrays for the wind speed and for the temperature. You will then use the stored data to calculate and output the average wind speed and the average temperature. Create a constant with a value of 30 and use that to declare and loop through your arrays and as a divisor to produce your averages. Here is the data file (below). 1. 14 25 2. 12...
Write a Java program, including comments, to compute statistics for how students did on an exam. The program should compute various things about a student and print it all out. Then it repeats the process for each new student until the entire set of data has been completed. (a) The program reads in and prints the ID number of a student [see step (g) below] and then the number of right answers and the number of wrong answers. (The total...
PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...
Hi - Some help create a short program that uses a pandas DataFrame (solution MUST use a DataFrame) to do the following. Please include comments /notes to explain what is going on. Solution does not need to define functions two csv files are included (grades01.csv): raw marks of students taking an examination; and a further csv file (rubric01.csv) summarizing the maximum mark available for each of the six questions. Structure of grades01: Student ID,Question 1,Question 2,Question 3,Question 4,Question 5,Question 6...