import java.io.*;
import java.util.*;
public class AP_ExamArray
{
//User Input AP Exam Scores Using For Loops
public static void main(String args[])
{
int [] scores = new int[5];
int j;
int sum_exam=0;
for (j=0; j<scores.length; j++)
{
Scanner kbReader = new Scanner(System.in);
System.out.println("Please enter AP Exam Score (1-5): ");
scores[j]=kbReader.nextInt();
sum_exam+=scores[j];
}
//Initializer List Final Percentage
double [] final_percent = {97.3, 89.8, 96.2, 70.1, 93.0};
double sum_percent=0;
int k;
for(k=0; k<final_percent.length;k++)
{
sum_percent+=final_percent[k];
}
// String array containing last name (while loop)
String [] last_name = new String[5];
int i=0;
while (i<last_name.length)
{
Scanner kbReader = new Scanner(System.in);
System.out.println("Please enter last name: ");
last_name[i]=kbReader.next();
i++;
}
//Average Exam Scores
double avg_exam = (double) sum_exam/scores.length;
//Average Final Percentage
double avg_percent = (double) sum_percent/final_percent.length;
}
}
方向是:
“对于您的输出,请使用循环打印学生姓名、百分比和考试成绩,并确保在每个列标题下方包含适当的数据:
学生姓名 学生百分比 学生考试成绩。”
我不知道该怎么做!