Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Question 1 (Classes, objects, non access modifiers): 1. Create a new project in Eclipse (File > New > Java Project.) Name it Homework1Q1.

image text in transcribed

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

image text in transcribed

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Question 1 (Classes, objects, non access modifiers): 1. Create a new project in Eclipse (File > New > Java Project.) Name it Homework1Q1. 2. Create a package named qa.edu.qu.cmps251.homework1, within this package there are two packages called model and runner 3. Create a class that defines an entity of your choice (fruit, shape, store, hospital, etc.). This class must go in the "model" subpackage you created in step 1. The class should contain: a. a minimum of 3 fields, 3 methods, plus getters and setters as applicable b. use appropriate access and non-access modifiers (private, static, public, final, etc.) c. two constructors, one default and one non-default 4. Create another class as a runner class in subpackage runner that you created in step 1. In this class you will have your main function. Name the class as you wish. 5. The runner class in step 4 will test the class by instantiating objects and calling the methods you created in step 2. Question 2 (Composition): inn i Create a new project in Eclipse (File > New > Java Project.) Name it Homework1Q2 Create a package for your classes Create a class that "has another class (Composition) Both classes need to have private fields and appropriate getters and setters Create a runner that: Sets the fields you specified in step 4 via both a constructor and via setters Prints the fields in both classes C. Changes at least one field in each class and prints the new values Be Creative! Avoid classes such as Soccer Match, BankAccount, Fruits and Oranges

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 Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions