Question: USING DR.JAVA Lab Exercise 7.1 Instructions: Name your program as YourLastNameFirstInitialLE71.java . From the code in LE 6.2, do the following: 1. You will NOT

USING DR.JAVA

Lab Exercise 7.1 Instructions: Name your program as YourLastNameFirstInitialLE71.java. From the code in LE 6.2, do the following:

1. You will NOT be changing any of the logic in the code for LE 6.2

2. Create a separate class called Restaurant. This class will have NO main().

3. Insert a default constructor in the Restaurant class. This is a method that is empty and its header looks like this: public NameOfClass()

4. Code an overloaded constructor that will receive an owner's name when an object for Restaurant is created in the main().

1. In the Restaurant class store the owner's name in a field (class variable) called ownerName.

2. You will insert the owner name in the header of the output.

5. Except, for the main(), take all the other methods in LE 6.2 and put them in the Restaurant class.

6. Transfer the fields from LE 6.2 to Restaurant.

7. Strip the word static from the fields and the method headers in the Restaurant class.

8. Cut and paste the main() from LE 6.2 into your program file for LE 7.1.

1. Prompt for the owner name.

2. Create an object of the Restaurant class.

1 . Format: NameOfClass objectName = new NameOfClass(capture of keyboard entry);

3. Use that object for the method calls in the main().

1. Format: objectName.methodName()

Make sure both classes are in the same directory.

To run both programs, you must run the class with the main().

Sample Output: The output is exactly the same as LE 6.2 except, there is a prompt for the company's name which also shows up in the output header. SAMPLE OUTPUT LE 7.1.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!