Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java code Homework: Course Equality Let's practice establishing object equality. Create a public class named Course. Course should define a single public constructor that accepts

java code image text in transcribed
Homework: Course Equality Let's practice establishing object equality. Create a public class named Course. Course should define a single public constructor that accepts three fields: a String (the department), a String (the course number, and yes, this must be a String) and an int (the enrollment). You are welcome to name these fields however you like! Your constructor should reject null departments and numbers and negative enrollments. You do not need to provide any getters and setters! Instead, define a single method named equals. Your equals method accepts an object as a single parameter. It should return true if the passed object is a course and has the same values for the department and number, and false otherwise

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

Step: 3

blur-text-image

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions