Write a java class named MyCourse10 whose UML diagram is shown below: MyCourse10
ID: 648207 • Letter: W
Question
Write a java class named MyCourse10 whose UML diagram is shown below:
MyCourse10
-courseName : String
-instructorName : String
-semester: String
-year: int
-school: String
-numberOfStudents
-numberOfTests
-names: String []
-scores: int [][]
-studentTotals: int []
-grades: char[]
-testAverages: double []
-lowestScoreIndex: int
-highestScoreIndex: int
Constructor receives the following:
course name
instructor
MyCourse10
-courseName : String
-instructorName : String
-semester: String
-year: int
-school: String
-numberOfStudents
-numberOfTests
-names: String []
-scores: int [][]
-studentTotals: int []
-grades: char[]
-testAverages: double []
-lowestScoreIndex: int
-highestScoreIndex: int
Constructor receives the following:
course name
instructor
Explanation / Answer
import java.util.*; public class Student { private String m_name; private int m_age; private String m_course; private String m_year; private String m_section; public Student( String name, int age, String course, String year, String section ) { m_name = name; m_age = age; m_course = course; m_year = year; m_section = section; } public String getName() { return m_name; } public int getAge() { return m_age; } public String getCourse() { return m_course; } public String getYear() { return m_year; } public String getSection() { return m_section; } public String toString() { return "name: " + m_name + ", age: " + m_age + ", course: " + m_course + ", year: " + m_year + ", section: " + m_section; } public static void main(String[] args) { ArrayList students = new ArrayList(); Scanner input = new Scanner(System.in); int menuChoice = 4; do { System.out.println(" Student Record Menu"); System.out.println(" 1. Add Student 2. View Students 3. Search Student 4. Exit"); try { System.out.println("Enter a choice: "); menuChoice = Integer.parseInt(input.nextLine()); } catch (NumberFormatException e) { continue; } if (menuChoice==1) { System.out.println("Full name:"); String name = input.nextLine(); int age = -1; do { try { System.out.println("Age:"); age = Integer.parseInt(input.nextLine()); } catch (NumberFormatException e) { System.out.println("Enter a number!"); continue; } } while (ageRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.