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:...
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...
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...
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...
i need help using python ( spyder)
only use files , loops if needed
is statement
do not use , def function or any other.
Exercise 1: Daily temperature is recorded for some weeks in files (templ.txt", temp2.txt, and temp3.txt; provided in the MOODLE). The first line contains number of weeks and the rest of the lines each represent the week number followed by temperature on the seven days of that week (see samples input files below). Write a python...
Can you please help solve and explain this...Thanks The Mini Mental State Examination (MMSE) is a commonly used test for diagnosing memory impairment in adults. This test is sometimes used in clinical settings as a part of the process for diagnosing dementia. A person’s cognitive status is determined by comparing his or her raw score with the descriptive statistics of a norm group of test takers of similar ages and educational levels. Imagine that you had administered the MMSE to...
The following table contains the ACT scores and the GPA for eight college students. Grade point average is based on a four-point scale and has been rounded to one digit after the decimal. Student GPA ACT 1 2.& 21 2 3.4 24 3 3.0 26 4 3.5 27 5 3.6 29 6 3.0 25 7 2.7 25 8 3.7 30 a) Estimate the relationship between GPA and ACT using OLS: that is, obtain the intercept and slope estimates in the...
Using the program segment and sample txt file below, write a program that contains a linked list of students. The program should allow the user to: 1. initialize list of students 2. add additional student to front of list 3. add additional student to rear of list 4. delete student 5. sort students alphabetically 6. sort students by idNum 7. show number of students in list 8. print students 9. quit program XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The program should be divided into the...