Question: 1 . Write a program to define the Course class that has a name, numberOfSeats, department and numberOfCourses ( which will keep track of how

1. Write a program to define the Course class that has a name, numberOfSeats, department and numberOfCourses (which will keep track of how many objects have been created of this class and allow users to get that value). The variable numberOfCourses will be shared by all instances of class, so declare this variable as static.
Have a method to set objects and another method to getNumberOfCourses. Since this method will return a value that is shared by all classes (which means it is not tied to a specific object), implement this method as static.
Write a test program to do the following:
Create object C1(CS155,40,CS)
Invoke getNumberOfCourses()
Create object C2(CS265,40,CS)
Invoke getNumberOfCourses()
Create object C3(CS300,25,CS)
Create object C4(CS315,30,CS)
Invoke getNumberOfCourses()
2. Implement the class TestPoint3D. Write a test program to read the coordinates of 3 points (P1, P2 and P3) and prints the distance between P1 & P2 and then prints the distance between P1 & P3. Label your answers. Use Java Application Programming Interface (API) has a Point2D class in the javafx.geometry package for representing a point in a two-dimensional plane.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!