Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a new project in BlueJ. Create two new classes in the project, with the following specifications: Class name: City Fields : name (String) population

Create a new project in BlueJ. Create two new classes in the project, with the following specifications:

Class name: City

Fields:

  • name (String)
  • population (long)

1 Constructor: takes parameters with the same name as the fields and uses them to initialize the fields (you will need to use 'this', for example this.name = name).

Methods: Write get-methods (getters) and set methods (setters) for all fields. The getters and setters should be named according to standard Java conventions (getFieldName and setFieldName if the field is named fieldName).

Class name: Point

Fields:

  • x (double)
  • y (double)

Constructors: Write two constructors: one that takes two parameters and initializes the two fields, and one that doesn't take any parameters and sets both fields to 0.

Methods: Write get-methods (getters) and set methods (setters) for all fields. Name the getters and setters according to Java conventions as described above.

Save the project as a jar file to submit.

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

Students also viewed these Databases questions

Question

3. Provide advice on how to help a plateaued employee.

Answered: 1 week ago