Write a BlueJ project consisting in a class named Lecture whose goal is to store a list of the student names (of type String) attending it. In addition to declaring and initializing the necessary fields, the class has to implement: • A method boolean addStudent(String name) that adds a name to the (internal) list and returns an appropriate value (see Hint): the returned boolean value must be the same returned by the method add of the “internal list”. • A method int getHomonymNumber(String name) that returns the number of students that have the indicated name. • A method void printCSList() that prints the list of student names, in one single line and separated by a comma. For example: Goofy, Donald, Mickey Notice that you may not print a comma after the last name! • A method boolean swap(int index1, int index2) that swaps 2 students names in the list and returns true if the operation is successful. • A method void testIt() that adds at least 4 students (at least two with the same name), prints the list on a single line, swaps 2 students, prints again the list and finally prints the number of students with the same name (for a name you inserted twice in the list

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a BlueJ project consisting in a class named Lecture whose goal is to store a list of the student names (of type

String) attending it. In addition to declaring and initializing the necessary fields, the class has to implement:

• A method boolean addStudent(String name) that adds a name to the (internal) list and returns an appropriate

value (see Hint): the returned boolean value must be the same returned by the method add of the “internal list”.

• A method int getHomonymNumber(String name) that returns the number of students that have the indicated

name.

• A method void printCSList() that prints the list of student names, in one single line and separated by a

comma. For example:

Goofy, Donald, Mickey

Notice that you may not print a comma after the last name!

• A method boolean swap(int index1, int index2) that swaps 2 students names in the list and returns true

if the operation is successful.

• A method void testIt() that adds at least 4 students (at least two with the same name), prints the list on a

single line, swaps 2 students, prints again the list and finally prints the number of students with the same name

(for a name you inserted twice in the list)

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Fundamentals of Component based Engineering
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY