Question: USING DR.JAVA or JAVA Lab Exercise 7.2 Instructions : Relocate the code for LE 5.2 into a separate class file without a main(). Name the

USING DR.JAVA or JAVA

Lab Exercise 7.2 Instructions: Relocate the code for LE 5.2 into a separate class file without a main(). Name the class Library. In this class,

Code a no-args (empty) constructor.

Relocate the Scanner field from LE 5.2. The field is non-static (i.e., leave out the word "static").

Copy all the methods from LE 5.2, except for the main().

Make the methods non-static.

Be attentive to your import statement(s).

In a separate file called YourLastNameFirstInitialLE72.java, copy the field textbooks and the main() from LE 5.2. Store YourLastNameFirstInitialLE72.java file in the same location as the Library.java file. In the main()

Instantiate an object of the Library class using that class' empty constructor.

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

So except for instantiating the Library class object, all the code from the main() in LE 5.2 is the same other than using the object to call the methods.

Be attentive to your import statement(s).

ProgramName referenceVariableName = new ProgramName();

referenceVariableName.methodName();

Sample Output: The prompts and output for this program will look exactly like the prompts and output for LE 5.2. SAMPLE OUTPUT LE 7.2.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!