R
Rufus
I'm "helping" (?) some high school students with their entry-level
computer science course. They need to write a class file that goes with
the following client file. The final grade is determined by the sum of
the higher of the students's two test scores and the exam. Offhand, I
don't remember the exact cut-offs for the letter grades, but it was
something like: >= 90 A; >=80 B; >= 60 C; >= 50 D; < 50 F.
Any help would be appreciated!
import javax.swing.*;
import java.text.DecimalFormat;
public class studentClient
{ // begin class
public static void main(String args[])
{ // begin main
// ***** declaration of constants *****
// ***** declaration of variables *****
String strin; // input string
String strout; // output string
// ***** create objects *****
Student s1 = new Student(); // default student
Student s2 = new Student(1234, 34, 41, 38);
Student s3 = new Student(2234, 24, 26, 27);
// ***** create input stream *****
ConsoleReader console = new ConsoleReader(System.in);
// ***** Print Banner *****
System.out.println("**********************************");
System.out.println("NAME: Your Name Here");
System.out.println("Class: Mine");
System.out.println("Assignment: ");
System.out.println("**********************************");
// ***** processing *****
System.out.println("Student 1");
s1.printStudent();
System.out.println("\n\n");
System.out.println("Student 2");
s2.printStudent();
System.out.println("\n\n");
System.out.println("Student 3");
s3.printStudent();
System.out.println("\n\n");
s1.setId(3234);
s1.setT1(35);
s1.setT2(33);
s1.setExam(34);
System.out.println("Student 1 again");
s1.printStudent();
s2.setExam(41);
System.out.println("Student 2 again");
s2.printStudent();
// ***** output *****
System.out.print("Student id\t" + "Test 1\t" + "Test 2\t");
System.out.println("Exam\t" + "Final\t" + "Letter");
System.out.print("\t" + s1.getId() + "\t" + s1.getT1() + "\t" +
s1.getT2());
System.out.println("\t" + s1.getExam() + "\t" + s1.getFinal() + "\t"
+ s1.getLetter());
System.out.print("\t" + s2.getId() + "\t" + s2.getT1() + "\t" +
s2.getT2());
System.out.println("\t" + s2.getExam() + "\t" + s2.getFinal() + "\t"
+ s2.getLetter());
System.out.print("\t" + s3.getId() + "\t" + s3.getT1() + "\t" +
s3.getT2());
System.out.println("\t" + s3.getExam() + "\t" + s3.getFinal() + "\t"
+ s3.getLetter());
// ***** closing message *****
System.out.println("end of processing");
} // end main
} // end class
computer science course. They need to write a class file that goes with
the following client file. The final grade is determined by the sum of
the higher of the students's two test scores and the exam. Offhand, I
don't remember the exact cut-offs for the letter grades, but it was
something like: >= 90 A; >=80 B; >= 60 C; >= 50 D; < 50 F.
Any help would be appreciated!
import javax.swing.*;
import java.text.DecimalFormat;
public class studentClient
{ // begin class
public static void main(String args[])
{ // begin main
// ***** declaration of constants *****
// ***** declaration of variables *****
String strin; // input string
String strout; // output string
// ***** create objects *****
Student s1 = new Student(); // default student
Student s2 = new Student(1234, 34, 41, 38);
Student s3 = new Student(2234, 24, 26, 27);
// ***** create input stream *****
ConsoleReader console = new ConsoleReader(System.in);
// ***** Print Banner *****
System.out.println("**********************************");
System.out.println("NAME: Your Name Here");
System.out.println("Class: Mine");
System.out.println("Assignment: ");
System.out.println("**********************************");
// ***** processing *****
System.out.println("Student 1");
s1.printStudent();
System.out.println("\n\n");
System.out.println("Student 2");
s2.printStudent();
System.out.println("\n\n");
System.out.println("Student 3");
s3.printStudent();
System.out.println("\n\n");
s1.setId(3234);
s1.setT1(35);
s1.setT2(33);
s1.setExam(34);
System.out.println("Student 1 again");
s1.printStudent();
s2.setExam(41);
System.out.println("Student 2 again");
s2.printStudent();
// ***** output *****
System.out.print("Student id\t" + "Test 1\t" + "Test 2\t");
System.out.println("Exam\t" + "Final\t" + "Letter");
System.out.print("\t" + s1.getId() + "\t" + s1.getT1() + "\t" +
s1.getT2());
System.out.println("\t" + s1.getExam() + "\t" + s1.getFinal() + "\t"
+ s1.getLetter());
System.out.print("\t" + s2.getId() + "\t" + s2.getT1() + "\t" +
s2.getT2());
System.out.println("\t" + s2.getExam() + "\t" + s2.getFinal() + "\t"
+ s2.getLetter());
System.out.print("\t" + s3.getId() + "\t" + s3.getT1() + "\t" +
s3.getT2());
System.out.println("\t" + s3.getExam() + "\t" + s3.getFinal() + "\t"
+ s3.getLetter());
// ***** closing message *****
System.out.println("end of processing");
} // end main
} // end class