0% found this document useful (0 votes)
4 views8 pages

Java

The document contains a Java program that manages student data, including their index numbers, midterm scores, and exam scores. It calculates final scores, grades, and statistics such as average, maximum, and minimum scores. The program is structured with multiple classes: Input, Output, and Process, each handling different aspects of data collection and processing.

Uploaded by

boadijoseph918
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

Java

The document contains a Java program that manages student data, including their index numbers, midterm scores, and exam scores. It calculates final scores, grades, and statistics such as average, maximum, and minimum scores. The program is structured with multiple classes: Input, Output, and Process, each handling different aspects of data collection and processing.

Uploaded by

boadijoseph918
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

import java.u�l.

Scanner;

public class Input {

private Scanner scanner = new Scanner(System.in);

private String[] index = new String[17];

private int[] midsem = new int[17];

private int[] exams = new int[17];

private double[] finalScore = new double[17];

public void getStudentData(){

for(int i=1; i <=17; i++){

System.out.println("Enter the "+ i + "th student index number ");

String indexNum = scanner.nextLine();

if(indexNumberExist(indexNum, i)){

System.out.println("\nIndex number already exist");

i--;

}else{

index[i] = indexNum;

for(int j = 1; j <= 17; j++){

String indexNum = index[j];

System.out.println("Enter Midsem score for " + indexNum + " ");

int midscore = scanner.nextInt();

midsem[j] = midscore;

System.out.println("\nEnter Exams score " + midscore + " ");


int exscore = scanner.nextInt();

exams[j] = exscore;

finalScore[j] = midscore * 0.3 + exscore * 0.7;

private boolean indexNumberExist(String i, int length){

if(length != 1){

for(int k = 1; k <= length; k++){

if(index[k].equals(i)){

return true;

return false;

public String[] studentIndex(){

return index;

public int[] studentMidsemScore(){

return midsem;

public int[] studentExamsScore(){

return exams;
}

public double[] studentFinalScore(){

return finalScore;

Main Class

public class Main {

public sta�c void main(String[] args) {

Output output = new Output();

output.init();

OutPut class

public class Output {

Process process = new Process();

public void init(){

process.start();

double max = process.maxScore();

double min = process.minScore();


for(int i = 0; i <= 17; i++) {

// i

System.out.println("The final score for " + process.index[i] + " is " + process.finalScore[i]);

// ii

System.out.println("The grade obtained by " + process.index[i] + " is " + process.grade[i]);

for(int i = 1; i <= 6; i++) {

// iii

if(i == 1){

System.out.println("A - " + process.gradeFreq[i]);

}else if(i == 2){

System.out.println("B - " + process.gradeFreq[i]);

}else if(i == 3){

System.out.println("C - " + process.gradeFreq[i]);

}else if(i == 4){

System.out.println("D - " + process.gradeFreq[i]);

}else if(i == 5){

System.out.println("F - " + process.gradeFreq[i]);

System.out.println("The average score is " + process.averageScore);

System.out.println("The Maximun score is " + process.maxScore());

System.out.println("The Minimun score is " + process.minScore());


}

Process Class

public class Process {

Input input = new Input();

String[] index = new String[17];

int[] midsem = new int[17];

int[] exams = new int[17];

double[] finalScore = new double[17];

char[] grade = new char[17];

int[] gradeFreq = new int[6];

double averageScore = 0;

public void start(){

input.getStudentData();

index = input.studentIndex();

midsem = input.studentMidsemScore();

exams = input.studentExamsScore();

finalScore = input.studentFinalScore();

calculateAverageScore();

calculateGrade();

gradeFrequency();

}
private void calculateAverageScore(){

double sum = 0.0;

for(double score: finalScore){

sum += score;

averageScore = sum/16;

private void calculateGrade(){

for(int i = 1; i <= 17; i++){

double score = finalScore[i];

if(score > 79){

grade[i] = 'A';

}else if(score > 69 && score < 70){

grade[i] = 'B';

}else if(score > 59 && score < 60){

grade[i] = 'C';

}else if(score > 49 && score < 50){

grade[i] = 'D';

}else if(score < 40){

grade[i] = 'F';

private void gradeFrequency(){

for(int i = 1; i <= 17; i++){

if(grade[i] == 'A'){
gradeFreq[1]++;

}else if(grade[i] == 'B'){

gradeFreq[2]++;

}else if(grade[i] == 'C'){

gradeFreq[3]++;

}else if(grade[i] == 'D'){

gradeFreq[4]++;

}else if(grade[i] == 'F'){

gradeFreq[5]++;

public double maxScore(){

double highestScore = 0;

for(int i = 1; i <= 17; i++){

double score = finalScore[i];

if(score > highestScore){

highestScore = score;

return highestScore;

public double minScore(){

double lowestScore = 100;

for(int i = 1; i <= 17; i++){

double score = finalScore[i];


if(score < lowestScore){

lowestScore = score;

return lowestScore;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy