Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

11. Are your speaking notes helpful and effective?

Answered: 1 week ago