This is one of four major individual assignments that you are required to complete in this class. You MUST design and code this project on your own. You can ask for debugging help, particularly from the tutors, TA or instructor, but this project is to be your own work. The project relies on knowledge and skills that you will develop in Recitation Laboratories 10-12. If you are having trouble with these recitations after your in-class session, please be sure that you come to the lab at another time and sit down with a tutor.
Write a super class (Average.java) that will represent an Average for a grade category. This super class will store the numerator and denominator for an average. It will also store the name of the grade category and the weight of that category for the course. For example suppose you have made a 15 out of 15, a 18 out of 20 and a 23 out of 25 for your projects. The projects are worth 15% of your overall average. By adding the numerators 15+18+23 = 56 and denominators 15+20+25 = 60, you can find the project average 56/60 = 93 and the partial average in relationship to the course average 56/60*15(weight) = 14. This means out of your final average 14 points were earned by your project grade. This means we don't have to store each individual grade in a category, just keep adding any grade earned to the numerator and the highest possible score for that grade to the denominator.
Write two classes that will inherit the Activity class: one will be used when the category has multiple grades like our projects, recitations and exams. The other will be used when the category has only one grade like our final exam.
The Course class is created for the course we are maintaining. It will perform most of the work needed to maintain our grades.
Finally, the client code will be provided for you. You can see what the methods will do and can use this as a means for testing your program. For extra credit you can add the ability to read data from a text file before the main menu starts and write data to the text file before the program ends. This will maintain grades between runs. (Makes this a very usable program).
Specifics of the project:Average Class
private data members:
Multigrade Class extends Average
private data members: none
methods:
Singlegrade Class extends Average
private data members: none
methods:
Course Class
private data members:
Client Code:
public class Project4Test {
public Project4Test() {}
public static void main(String[] args) {
Course cs1713 = new Course("CS 1713");
cs1713.addMultiGradeType("Projects",15);
cs1713.addMultiGradeType("Recitations",15);
cs1713.addMultiGradeType("Exams",40);
cs1713.addSingleGradeType("Final Exam",30);
char response;
int n;
int d;
String group;
do {
group = "";
response = 'a';
System.out.println("Would you like to: enter the number of your choice: ");
System.out.println("Add a grade to:");
System.out.println(" 1) Projects");
System.out.println(" 2) Recitations");
System.out.println(" 3) Exams");
System.out.println(" 4) Final Exam");
System.out.println("5) Print Current Partial and Total Averages");
System.out.println("6) Find out what you need to make on the Final Exam");
System.out.println("7) Find out for which type of grade you did the best");
System.out.println("0) Quit");
response = Keyboard.readChar();
switch (response) {
case '1' :
group = "Projects";
break;
case '2' :
group = "Recitations";
break;
case '3' :
group = "Exams";
break;
case '4' :
group = "Final Exam";
break;
case '5' :
System.out.println(cs1713);
cs1713.printAverage();
break;
case '6' :
System.out.println("Enter the grade you want to earn for the course");
int desiredScore = Keyboard.readInt();
System.out.println(cs1713.testFinal(desiredScore));
break;
case '7' :
System.out.println(cs1713.findMax());
break;
}
if (group.compareTo("")!=0) {
System.out.println("Enter the grade");
n = Keyboard.readInt();
System.out.println("Enter the highest possible grade");
d = Keyboard.readInt();
cs1713.addGrade(group,n,d);
}
} while (response != '0');
}
}
|
Question:
In the course class we could have created an array for all of the grade types,
not just the multigrades. Write code that would create a four element
array of either multigrade or a singlegrade. Rewrite the code for
addSingleGradeType and addMultiGradeType to reflect how to add either type of
element to the same array.
Hints:
(I'm trying to answer some of the questions that have arisen.)
email type-o reporting to mdoderer@cs.utsa.edu