Ceate an application which represents a simplified course

Assignment Help JAVA Programming
Reference no: EM13346816

Create an application which represents a simplified course registration system using ArrayLists and HashMaps.

Define a class called Student with private attributes representing the student id (an int), the student's name (a String) and an ArrayList called regCourses containing Course objects that the student is registered in.

  • Create get methods for all 3 attributes.
  • Create a constructor that initializes attributes id, and name from incoming parameters, and initializes attribute regCourses to an empty ArrayList.
  • Create a toString() method that returns a string representing a student using the format as shown in the 2 examples below (Note: There is no comma at the end of the course lists):   

Define a class called Course with private attributes representing the department in which the course is offered (a Department object), the course code (e.g., 1406), the course name (e.g., "Introduction to Computer Science II") and a classList ArrayList containing Student objects who are registered in the course.

  • Create get methods for attributes code, department and classList.
  • Create a constructor that initializes attributes code, department and name from incoming parameters, and initializes classList to an empty ArrayList.
  • Create a toString() method that returns a string with the course code, course name and the number of people registered in the course in a format as shown in the following examples:

COMP1406 Introduction to Computer Science II, Enrollment = 238 
HIST1001 Canadian History, Enrollment = 12
 
Define a class called Department with private attributes representing the name (e.g., "Computer Science"), the departmental id (e.g., "COMP"), a courseList HashMap representing all courses offered by this department (with a course code as key and Course object as value) and a studentList ArrayList representing all students taking courses in this department.

  • Create get methods for all 4 attributes.
  • Create a constructor that creates a department whose name and id are specified as parameters and then also initializes the hashmap and array list to be empty.
  • Create a toString() method that shows the name and number of courses offered and students

registered in the department as follows:
School of Computer Science:  47 courses, 387 students
Make sure that ALL your code compiles at this point.   Test your code with the following program:

 public class TestProgram1 {
    public static void main(String[] args) {
     Department scs = new Department("School of Computer Science", "COMP");
  Department his = new Department("History", "HIST");
  System.out.println(scs);
  System.out.println(his);
 
  Course  c1406 = new Course(1406, scs, "Introduction to Computer Science II");
  Course  c1001 = new Course(1001, his, "Canadian History");
  System.out.println(c1406);
  System.out.println(c1001);
 
  Student matt = new Student(100239872, "Matt Adore");
  Student june = new Student(100125673, "June Bug");
  System.out.println(matt);
  System.out.println(june);
    }
}
 
It should have this output:
 
School of Computer Science: 0 courses, 0 students
History: 0 courses, 0 students
COMP1406 Introduction to Computer Science II, Enrollment = 0
HIST1001 Canadian History, Enrollment = 0
100239872 Matt Adore - Registered Courses: NONE
100125673 June Bug - Registered Courses: NONE 

(2) The "Meat":

1. Write a method in the Department class called offerCourse(Course c) that adds the given course to the department.   You may assume that the course is not already offered.

2. Write a method in the Department class called printCoursesOffered() that displays on the system console a list of all courses offered by the department.   Note that it should show all course information (i.e., use the toString() method).

3. Write a method in the Student class called isRegisteredInCourse(Course c) that returns a boolean which indicates whether or not the given student is registered in the given course.

4. Write a method in the Student class called registerFor(Course c) that causes the student to be registered for the given course.   If the student is already registered in the course, do nothing. Otherwise, update the appropriate Student, Course and Department objects as necessary.

5. Write a method in the Department class called printStudents() that displays on the system console a list of all students who are taking courses in this department.   Note that it should show all student information (i.e., use the toString() method).

6. Write a method in the Department class called isStudentRegistered(Student s) that returns a boolean which indicates whether or not the given student is registered for any course in this department.

7. Write a method in the Department class called studentsRegisteredInCourse(int code) that returns an ArrayList containing all students who are registered in the course with the given code.

8. Write a method in the Department class called printStudentsRegisteredInCourse(int code) that uses the method you just wrote to display on the system console a list of all students registered in the given course. This method should show only the id and name of the students.

9. Write a method in the Department class called largestEnrollment() which returns a Course object showing the course with the largest number of registered students. Note that if there are two or more courses with the same largest number, return either one.   You should use the values of the courseList hashmap.   Also, if there are no courses, null should be returned. 
 
10. Write a class (i.e., static) method in the Department class called areClassmates(Student s1, Student s2) which returns a boolean indicating whether or not these two students are taking any courses together. 

Reference no: EM13346816

Questions Cloud

Soda vending machine designnbsp design a soda vending : soda vending machine designnbsp design a soda vending machine that can deliver three kinds of soda a b and c. allnbsp
Increased usage of the internet has caused a decrease in : increased usage of the internet has caused a decrease in usage of traditional media like tv radio and print. how will
Generate revenue for city under consideration the two : generate revenue for city under consideration. the two proposals are london congestion charge and charging for
A cost-benefit analysis of electronic medical records in : a cost-benefit analysis of electronic medical records in primary carethere are two categories of costs associated with
Ceate an application which represents a simplified course : create an application which represents a simplified course registration system using arraylists and hashmaps.define a
Capital structure and leveragethe effect of financial : capital structure and leveragethe effect of financial leveragebiddle publishing currently is financed with 10 debt and
The role of hr in the 21stnbsp century is becoming : the role of hr in the 21stnbsp century is becoming increasingly vital. a significant claim in support of strategic
Part - 1 object-oriented designwrite a program that allows : part - 1 object-oriented designwrite a program that allows an instructor to keep a grade book. each students has scores
Pulse width modulatorpart-1introduction a pulse width : pulse width modulatorpart-1introduction a pulse width modulation pwm circuit works by varying the duty cycle of the

Reviews

Write a Review

JAVA Programming Questions & Answers

  Application named arithmeticmethods

Create an application named ArithmeticMethods whose main() method holds two integer variables. Assign values to the variables. In turn, pass each value to methods named displayNumberPlus10()

  Development of a graphical user interface

To understand actual communication with an SMTP server can be achieved using TCP Sockets and understand the development of a graphical user interface (GUI) and use of event handling.

  Class named person with fields for holding a person''s name

Design a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class's fields.

  Small computer system interface-standard computer disk

How many primary drive partitions are supported on computers that still conform to the standard established by MS-DOS? How many total partitions can a standard computer disk [Intergrated Drive Electronics (IDE)/Serial Advanced Technology Attachment (..

  Explain where the following method invocations

Explain where the following method invocations are most likely to be found in a program for dealing with census data organized using the Model, View, Controller (MVC) design pattern. Choices are zero or more of Model, View, and Controller. Be sure to..

  Design a program to help a videorental store

Design classes (class video, class customer, etc) based on your analysis above, using LINKED LISTS for the database elements read into the main memory.

  Write java program to enter number of marks

Write a java program called AverageMark.java. This program should allow the user to enter any number of marks and then display the minimum, maximum & average mark.

  Information systems to strengthen customer

Which of the following illustrates the use of information systems to strengthen customer and supplier intimacy? BPM is considered concluded when the new processes are both implemented and accepted.

  Have to implement a search algorithm

Suppose you have to implement a search algorithm in a high programming language such as Java or C++. You are given a linked list that is not sorted and it's rather small, in the order of a few dozen elements.

  Variable is named res and is used to input a resistanc

Assume the existence of the following Java GUI application. There are two text fields for user input. The first JTextField variable is named res and is used to input a resistance value in ohms. The second JTextField variable named cap is used to..

  Implement the lexical and syntactic analysis

Implement the lexical and syntactic analysis of Minifun programming language.

  Demonstrates conditions under which the compareto() method

Write an application that demonstrates conditions under which the compareTo() method retrun a positive number, a negative number, and a zero when used to compare two Strings, Save the file as CompareStringValues.java. Lab Assignment

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd