Tasks - Graded Course Class • Task 1: The Graded Course class contains all the functionality of the Course class as it i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Tasks - Graded Course Class • Task 1: The Graded Course class contains all the functionality of the Course class as it i

Post by answerhappygod »

Tasks Graded Course Class Task 1 The Graded Course Class Contains All The Functionality Of The Course Class As It I 1
Tasks Graded Course Class Task 1 The Graded Course Class Contains All The Functionality Of The Course Class As It I 1 (87.76 KiB) Viewed 39 times
Please use exact methods and arguments
USE THIS TEMPLATE FOR GRADEDCOURSE
package assignment;
public class GradedCourse extends Course{//See Assignment 3 or "High Level View of Your Tasks" in Folio tosee what Course contains
/*** The course awards a letter Grade* The numeric score to letter grade is based on the values providedin the constructor.* (Remember that the Student class has computeMyAverage as amethod)* @return the number of students who's average of all the student'squizzes is at or better then the score that maps to the lettergrade* e.g. (notice the extra newline at the beginning)
1 students on track for A4 students on track for B7 students on track for C2 students on track for D*/public String countABCDFStudents() {return "";}/*** Name of this Graded Course* @param courseName*/public GradedCourse(String courseName, double minScoreForA, doubleminScoreForB, double minScoreForC, double minScoreForD) {super("CHANGE THIS");}/*** @return a string that mentions the course name, type of course,number of students in A,B,C,D, and the super's toString* e.g.
Underwater Basket Weaving is a letter grade course.1 students on track for A1 students on track for B1 students on track for C1 students on track for D
Students in this course:[Bugsy 521, Daisy 321, Minny 876, Mikey 543]*/public String toString() {return "";}}USE THIS TO CHECK GRADEDCOURSE
Tasks Graded Course Class Task 1 The Graded Course Class Contains All The Functionality Of The Course Class As It I 2
Tasks Graded Course Class Task 1 The Graded Course Class Contains All The Functionality Of The Course Class As It I 2 (78.93 KiB) Viewed 39 times
package assignment;import java.util.ArrayList;public class Course {// member variable to store all students in a courseArrayList<Student> students;// default constructorpublic Course() {students = new ArrayList<Student>();}/*** @return the allStudents*/public ArrayList<Student> getAllStudents() {return students;}/*** @param allStudents the allStudents to set*/public void setAllStudents(ArrayList<Student> allStudents){students = allStudents;}/**** @param stu Student object* @return true if successfully added, false otherwise*/public boolean addStudent(Student stu) {// if not validif (stu == null)return true;// loop over all students and check if already existsfor (Student student : students) {if (student.equals(stu))return false;}return students.add(stu);}/*** @desc removes a student if exists* @param stu Student object* @return true if already exists, false otherwise*/public boolean removeStudent(Student stu) {// remove the student if valid and existsreturn students.remove(stu);}/*** @desc updates a student if it exists* @param stu* @return true if students exists and update successfull,* false otherwise*/public boolean updateStudent(Student stu) {// if not validif (stu == null)return false;// if list containts the studentif (students.contains(stu)) {students.set(students.indexOf(stu), stu);return true;}return false;}/*** @return the average of all the student's quizzes*/public double computeCourseAverage() {double scoresAvgSum = 0.0;int totalScores = 0;for(int i = 0;i<students.size();i++){if(students.get(i) != null) {Score[] studentScores = students.get(i).getAllMyScores();for(int j = 0; j < studentScores.length; j++) {if(studentScores[j] != null) {scoresAvgSum += studentScores[j].getScoreValue();totalScores++;}}}}
return scoresAvgSum/totalScores;}public String getNumberOfStudents() {// TODO Auto-generated method stubreturn null;}}
Course class has been provided from A3
Tasks - Graded Course Class • Task 1: The Graded Course class contains all the functionality of the Course class as it is a child class of Course class. You are given the Course class in the provided jar file named A3.jar. • Task 2: A Graded Course object can be created by giving as an argument a course name as a String, followed by the minimum score for an A letter grade, followed by the minimum score for an B letter grade, followed by the minimum score for an C letter grade, followed by the minimum score for an D letter grade. These minimum score for letter grades will be used by the countABCDFStudents() method. Complete the method public GradedCourse(String courseName, double minScore ForA, double min.ScoreForB, double minScoreForC, double minScoreForD) to complete this task. See the method comments for more detail.. • Task 3: The user can get the number of students on track for A, B, C, or D letter grades in this Graded Course. The method will return a String containing the number of students who's average of all the student's quizzes is at or better then the score that maps to the letter grades, A, B, C or D. Complete the method public String countABCDFStudents() to complete this task. See the method comments for more detail. oe.g. 1 students on track for A 4 students on track for B 7 students on track for C 2 students on track for D • Task 4: The user will be able to ask for the textual representation of this GradedCourse instance. The method will return a String in the form specified in the example below. Complete the method public String toString() to complete this task. See the method comments for more detail. Underwater Basket Weaving is a letter grade course. 1 students on track for A students on track for B 1 students on track for C 1 students on track for D Students in this course: [Bugsy 521, Daisy 321, Minny 876, Mikey 543] Test your code using the A4GradedDriver class, then submit your code on Gradescope. Fix any issues and resubmit to Gradescope as many time before the deadline as needed to maximize your score for this task. A4GradedDriver Example Output Add Student to course successfully ->true Add Student to course successfully ->true Add Student to course successfully ->true Add Student to course successfully ->true Course average for all students ->79.9075 Number of Students in the Course ->4 toString prints the following Underwater Basket Weaving is a letter grade course. 1 students on track for A 1 students on track for B 1 students on track for C 1 students on track for D Students in this course: [Bugsy 521, Daisy 321, Minny 876, Mikey 543]
package assignment; public class A4GradedDriver { B public static void main(String[] args) { //NOTE: BELOW IS A STARTER SET OF TEST FOR YOUR ASSIGNMENT. //IT IS NOT THE ONLY SET OF TESTS YOU SHOULD DO FOR YOUR ASSIGNMENT ! //Student Class Student stul = new Student ("Bugsy", 521); stul. AddScore (new Score ("q1", 90.1)); stul. AddScore (new Score ("q2", 87.21)); stul.AddScore (new Score ("q3", 94)); Student stu2 = new Student ("Daisy", 321); stu2. AddScore (new Score ("ql", 80.36)); stu2. AddScore (new Score ("q2", 92.70)); stu2. AddScore (new Score ("q3", 86.3)); Student stu3 = new Student ("Minny", 876); stu3.AddScore (new Score ("q1", 75.75)); stu3.AddScore (new Score ("q2", 83.45)); stu3.AddScore (new Score ("q3", 78.98)); Student stu4 = new Student ("Mikey", 543); stu4.AddScore (new Score ("ql", 60.99)); stu4.AddScore (new Score ("q2", 78.67)); stu4.AddScore (new Score ("q3", 50.38)); //GradedCourse object stored in Course object reference variable Course cou = new GradedCourse ("Underwater Basket Weaving", 90, 80, 70, 60); System.out.println("Add Student to course successfully ->"+ cou.addStudent (stul)); System.out.println("Add Student to course successfully ->"+cou.addStudent (stu2)); System.out.println("Add Student to course successfully ->"+ cou.addStudent (stu3)); System.out.println("Add Student to course successfully ->"+ cou.addStudent (stu4)); System.out.println("Course average for all students ->"+ cou.compute CourseAverage () ); System.out.println("Number of Students in the Course ->"+cou.getAllStudents ().size()); System.out.println("toString prints the following\n"+cou.toString() );
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply