Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Class Diagram: The class is described by the UML (universal modeling language) diagram below. Course MAX SECTION SIZE: int - 50 - code: Strinel

Java

image text in transcribed

image text in transcribed

Class Diagram: The class is described by the UML (universal modeling language) diagram below. Course MAX SECTION SIZE: int - 50 - code: Strinel name: String - numStudents: int - numSections: int Course info:Stringi calcNur Sections numStudents:int): int + getCodel : String[] +getName(): String + getNumStudents(): int getNumSections(): int + toString): String Recall that a class diagram consists of three compartments containing the following information: Top: class name Middle: fields Bottom: method signature's The plus and minus signs represent access modifiers. A plus means that a field or method is public, while a minus means that it is private. An underlined identifier means that a field or method is static. Field Info: MAX_SECTION_SIZE: a constant that stores the maximum number of students that can be enrolled in a section. Set this field equal to 50. code: a two-element array containing the subject abbreviation and the course number. For instance, the code for our course is "CS 2334", so the code field would be ["CS","2334"). name: the name of the course le.c. "Programming Structures and Abstractions"). numStudents: the number of students enrolled in the course. numSections: the number of sections offered for the course. Constructor Info: The constructor is given a String that specifies the course code, name, and number of students. This information is separated by commas. For example, to create an object for our course, we would pass the constructor the String 'CS 2334.Programming Structures and Abstractions, 118". (Note that there are no spaces on either side of each comma.) The constructor must split the String and assign each piece of information to the corresponding field. Method Info: calcNumSections. This method is used by the constructor to calculate the number of sections from the number of students. Assume that only one section can be partially full. For example, if there are 148 students in the class, there must be 3 sections. getCode: This method returns a copy of the code field. A copy must be returned because Course objects should be immutable. (Note that the class diagram does not have any mutator methods.) .toString: This method returns a String with all of the course information. The String should have the following format: "CODE: NAME: STUDENTS: SECTIONS:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago