Question: USING DRJAVA OR JAVA LE 7.3 worth 6 points or 2 lab exercises!!! Purpose : To learn how to create a package (folder), import a

USING DRJAVA OR JAVA

LE 7.3 worth 6 points or 2 lab exercises!!!

Purpose: To learn how to create a package (folder), import a class within a package, create an object using a constructor to populate the object, use set methods to populate an object with data, and use get methods to retrieve data from an object. Prep Work: Chapter 7; Shepherd's chapter 7 PowerPoint slides. READ the instructions below carefully. Lab Exercise 7.3 Instructions: Follow these instructions exactly and in the order listed.

Create a folder with YourLastNameFirstInitialLE73.

Inside of that folder create 3 more folders:

classes

src

jobs (this folder can be within the src folder)

In DrJava create a project folder (Creating Projects in DrJava.pdf) as YourLastNameFirstInitialLE73.

Add the folders to the project (see link in #2.4 above).

Add a new file to the jobs folder and call it TopITJob.

Structure of project folder for LE 7.3: LE 7.3 Project Folder Hierarchy, Package Statement & Import Statement.pdf

In the program with the main(), import the TopITJob class. The import statement will look like this: import nameOfFolder.NameOfProgram;

In the TopITJob program

code a package statement as the very first line: package nameOfFolder;

code 3 fields (class level variables): one to store the position, the other one to store the average annual salary, and the last one to store the number of created objects;

code 2 constructors: one that is parameterless with an empty method body, and the other that will accept 2 arguments through its parameter list. The names of the parameter variables are the same as the fields. Use the parameter variables to populate the 2 fields. (Add a proper code to the body of each constructor to update the value of the count field);

code individual set methods in which one prompts for the position and the other prompts for the average annual salary;

code individual get methods that return each field (class variable).

In the main()

code a TopITJob object by sending to it a top IT position and that position's average annual salary (look at which constructor you'll be using);

code another TopITJob object using the parameterless constructor;

print "Top IT Job #2: "

use the object to call the methods that set the fields;

print the output by following the spacing and line advances in the attached sample output.

Don't forget to end the main() with an exit statement.

Sample Output: SAMPLE OUTPUT LE 7.3.pdf

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!