Hello I need help with this assignment. It should be done in java programming la
ID: 3606530 • Letter: H
Question
Hello I need help with this assignment. It should be done in java programming language. Really need someone to help me with this assignment. It is due tomorrow and I am pretty lost. Thankyou!
There are 5 files linked in here http://www.filedropper.com/progivstuff
this program contains 5 files - Course.java, Student.java, StudentDriver.java, CoursesTaken.txt, and CurrentCourses.txt. Course.java and Student.java both contain many unimplemented methods that you must implement. StudentDriver.java is already implemented and must not be changed in any way. CoursesTaken.txt and CurrentCourses.txt contain data that you must use to construct an ArrayList of courses that a student has already taken and an ArrayList of courses that a student is currently taking. A correct run of your program using this data is as follows:
Please enter the name of the file with the courses taken:
CoursesTaken.txt
Please enter the name of the file with the current courses:
CurrentCourses.txt
Course Designator: IT
Course Number: 210
Course Description: Introduction to Programming
Section: 2
Letter Grade: B
Course Designator: IT
Course Number: 214
Course Description: Introduction to Software Development
Section: 1
Letter Grade: A
Course Designator: IT
Course Number: 310
Course Description: Data Structures
Section: 1
Letter Grade: B
Course Designator: IT
Course Number: 414
Course Description: Advanced Object-Oriented Programming with Design Patterns
Section: 2
Letter Grade: C
Course Designator: IT
Course Number: 483
Course Description: Web Applications and User Interface Design
Section: 1
Letter Grade: A
Course Designator: IT
Course Number: 340
Course Description: Introduction to Database Systems
Section: 1
Letter Grade: B
id: 00001234
First Name: Joe
Last Name: Student
Major: Anthropology
Minor: Biology
Gpa: 3.17
Explanation / Answer
/*
StudentDriver.java, CoursesTaken.txt, CurrentCourses.txt didn't change. so i am not pasting that code.
*/
// Course.java
/**
A Course class that maintains course information
via the instance variables specified
*/
public class Course {
String courseDesignator;
String courseNumber;
String courseDescription;
int credits;
String section;
String letterGrade;
/**
Course constructor
*/
public Course(String courseDesignator, String courseNumber,String courseDescription, int credits, String section, String letterGrade) {
//Your code goes here
this.courseDesignator = courseDesignator;
this.courseNumber = courseNumber;
this.courseDescription = courseDescription;
this.credits = credits;
this.section = section;
this.letterGrade = letterGrade;
}
public String getCourseDesignator() {
//Your code goes here
return this.courseDesignator;
}
public void setCourseDesignator(String courseDesignator) {
//Your code goes here
this.courseDesignator = courseDesignator;
}
public String getCourseNumber() {
//Your code goes here
return this.courseNumber;
}
public void setCourseNumber(String courseNumber) {
//Your code goes here
this.courseNumber = courseNumber;
}
public String getCourseDescription() {
//Your code goes here
return courseDescription;
}
public void setCourseDescription(String courseDescription) {
//Your code goes here
this.courseDescription = courseDescription;
}
public int getCredits() {
//Your code goes here;
return this.credits;
}
public void setCredits(int credits) {
//Your code goes here
this.credits = credits;
}
public String getSection() {
//Your code goes here
return this.section;
}
public void setSection(String section) {
//Your code goes here
this.section = section;
}
public String getLetterGrade() {
//Your code goes here
return this.letterGrade;
}
public void setLetterGrade(String letterGrade) {
//Your code goes here
this.letterGrade = letterGrade;
}
public boolean equals(Course obj) {
//Your code goes here
//base it on courseDesignator, courseNumber, courseDescription, credits, and section
courseDesignator = obj.getCourseDesignator();
courseDescription = obj.getCourseDescription();
courseNumber = obj.getCourseNumber();
credits = obj.getCredits();
section = obj.getSection();
if((courseDesignator.equals(this.getCourseDesignator()))&&(courseNumber.equals(this.getCourseNumber()))&&(courseDescription.equals(this.getCourseDescription()))&&(credits==(this.getCredits()))&&(section.equals(this.getSection()))){
return true;
}
else{
return false;
}
}
public String toString() {
//Your code goes here
return "Course Designator: " + this.courseDesignator + " " + "Course Number: " + this.courseNumber + " " + "Course Description: " + this.courseDescription + " " + "Section: " + this.section + " " + "LetterGrade: " + this.letterGrade;
}
}
//Student.java
import java.util.ArrayList;
import java.text.DecimalFormat;
/**
A Student class that maintains course information
via the instance variables specified
*/
public class Student {
private String id;
private String firstName;
private String lastName;
private String major;
private String minor;
private ArrayList<Course> coursesTaken;
private ArrayList<Course> currentSemesterCourses;
private double gpa;
/**
Course constructor
*/
public Student(String id, String firstName, String lastName, String major, String minor, ArrayList<Course> coursesTaken, ArrayList<Course> currentSemesterCourses) {
/*Your code goes here */
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.major = major;
this.minor = minor;
this.coursesTaken = coursesTaken;
this.currentSemesterCourses = currentSemesterCourses;
}
/* This method calculates a student's gpa by iterating through the list of courses taken and obtaining the number of credits and the letter grades
for each course. It uses the letterGradeConverter() method to give the numeric value for a given letter grade. E.g., if the letter
grade is "A", it returns 4, etc.*/
/*Actual Gpa generation formula will be different, you didn't explained the formula.
So, as per given information, i calculated GPA.
*/
public double calculateGpa() {
//Your code goes here
double total_grades = 0;
double total_credits = 0;
for (Course myCourse : this.getCoursesTaken()) {
String letterGrade = myCourse.getLetterGrade();
int grade = letterGradeConverter(letterGrade);
int credits = myCourse.getCredits();
System.out.println(grade+","+credits);
total_credits = total_credits + credits;
total_grades = total_grades + grade;
}
return total_grades/total_credits;
}
/* Returns the numeric value for a letter grade passed in as a parameter.
E.g., if the letter
grade is "A", it returns 4, etc.
*/
public int letterGradeConverter(String letterGrade) {
//Your code goes here
if(letterGrade.equals("A")){
return 4;
}
else if(letterGrade.equals("B")){
return 3;
}
else if(letterGrade.equals("C")){
return 2;
}
else if(letterGrade.equals("D")){
return 1;
}
return -1;
}
public String getId() {
//Your code goes here
return this.id;
}
public void setId(String id) {
//Your code goes here
this.id = id;
}
public String getFirstName() {
//Your code goes here
return this.firstName;
}
public void setFirstName(String firstName) {
//Your code goes here
this.firstName = firstName;
}
public String getLastName() {
//Your code goes here
return this.lastName;
}
public void setLastName(String lastName) {
//Your code goes here
this.lastName = lastName;
}
public String getMajor() {
//Your code goes here
return this.major;
}
public void setMajor(String Major) {
//Your code goes here
this.major = Major;
}
public String getMinor() {
//Your code goes here
return this.minor;
}
public void setMinor(String Minor) {
//Your code goes here
this.minor = Minor;
}
public double getGpa() {
//Your code goes here
return this.gpa;
}
public void setGpa(double gpa) {
//Your code goes here;
this.gpa = gpa;
}
public ArrayList<Course> getCoursesTaken() {
//Your code goes here
return this.coursesTaken;
}
public void setCoursesTaken(ArrayList<Course> coursesTaken) {
//Your code goes here
this.coursesTaken = coursesTaken;
}
public ArrayList<Course> getCurrentSemesterCourses() {
//Your code goes here
return this.currentSemesterCourses;
}
public void setCurrentSemesterCourses(ArrayList<Course> currentSemesterCourses) {
//Your code goes here
this.currentSemesterCourses = currentSemesterCourses;
}
/*This method copies all of the courses in the list of courses that a student is currently taking into
the list of courses that a student has already taken. It then calculates the students gpa based on
the expanded list of courses that a student has already taken. The list of courses that a student is currently
taken is then cleared*/
public void merge() {
//Your code goes here
for (Course myCourse : this.getCurrentSemesterCourses()) {
this.coursesTaken.add(myCourse);
}
this.gpa = this.calculateGpa();
this.currentSemesterCourses = null;
}
/*An already implemented toString() method */
public String toString() {
DecimalFormat formatter = new DecimalFormat("###.##");
String gpaString = formatter.format(gpa);
return "id: " + id + " " + "First Name: " + firstName + " " + "Last Name: " + lastName + " " + "Major: " + major + " " + "Minor: " + minor +
" " +"Gpa: " + gpaString;
}
public boolean equals(Student obj) {
//Your code goes here
//base it on id firstName, lastName, major, minor and gpa
if(((obj.firstName).equals(this.firstName))&&((obj.lastName).equals(this.lastName))&&((obj.major).equals(this.major))&&((obj.minor).equals(this.minor))&&((obj.gpa)==(this.gpa))){
return true;
}
else {
return false;
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.