Compulsory Task 1 Answer the following questions: yperionDev • Design a class called Course. The class should contain: o The data fields courseName (String), numberOfStudents (int) and courseLecturer (String). A constructor that constructs a Course object with the specified courseName, numberOfStudents and courseLecturer. The relevant get and set methods for the data fields. A toString() method that formats that returns a string that represents a course object in the following format: (courseName, courseLecturer, numberOfStudents) • Create a new ArrayList called courses, add 5 courses to it and print it out. • Sort the List according to the numberOfStudents and print it out. • Swap the element at position 1 of the List with the element at position 2 and print it out. • Create a new ArrayList called courses2. • Using the addAll method add 5 courses to the courses2 List and print it out. • Copy all of the courses from courses into courses2 • Add the following two elements to courses2: Java 101, Dr. P Green, 55) (Advanced Programming, Prof. M Milton, 93) • Sort the courses in courses2 alphabetically according to the course name and print it out. • Search for the course "Java 101" in courses and print out the index of the course in the List. • Use the disjoint function to determine whether courses and courses2 have any elements in common and print out the result. Copyright © 2021 Hyperion Dev. All rights reserved. In courses2, find the course with the most students and the course with the least students and print each out.
Compulsory Task 1 Answer the following questions: yperionDev • Design a class called Course. The class should contain: o The data fields courseName (String), numberOfStudents (int) and courseLecturer (String). A constructor that constructs a Course object with the specified courseName, numberOfStudents and courseLecturer. The relevant get and set methods for the data fields. A toString() method that formats that returns a string that represents a course object in the following format: (courseName, courseLecturer, numberOfStudents) • Create a new ArrayList called courses, add 5 courses to it and print it out. • Sort the List according to the numberOfStudents and print it out. • Swap the element at position 1 of the List with the element at position 2 and print it out. • Create a new ArrayList called courses2. • Using the addAll method add 5 courses to the courses2 List and print it out. • Copy all of the courses from courses into courses2 • Add the following two elements to courses2: Java 101, Dr. P Green, 55) (Advanced Programming, Prof. M Milton, 93) • Sort the courses in courses2 alphabetically according to the course name and print it out. • Search for the course "Java 101" in courses and print out the index of the course in the List. • Use the disjoint function to determine whether courses and courses2 have any elements in common and print out the result. Copyright © 2021 Hyperion Dev. All rights reserved. In courses2, find the course with the most students and the course with the least students and print each out.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education