Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a main program that uses the classes you created in the previous question as per the requirements below: a) Your main program should create

image text in transcribed
image text in transcribed
Write a main program that uses the classes you created in the previous question as per the requirements below: a) Your main program should create two instances (objects), one for each class in the previous question. (5 points) b) Output a String representation of both objects to the console. (5 points) c) Output the name of just one of your object instances to the console. (5 points) Extra Credit Write an accessor method that would go in your first class and can be used to retrieve the name instance variable of the second class. (5 points) Write the Java code for two classes (Customer and Order) as per the requirements below: 1. The Customer class has a name and an order as instance variables. The name is a variable of type String. The order is an object of type Order. 2. The Order class has an orderName and an orderNumber as instance variables. The orderName is a variable of type String and the orderNumber is a variable of type int. a) Implement both classes with the appropriate instance variables (5 points). b) Implement constructors for both classes. The constructors should set all instance variables appropriately (10 points) Hint: Remember that objects store memory addresses and any Customer that has the same Order object will reference the same existing object in memory. Make sure you accommodate for this issue in your constructor c) Implement an accessor method (getter) for the name of the customer in the Customer class (5 points). d) Implement a mutator method (setter) for the order Number in the Order class (5 points) e) Implement a method in the Order class called checkout. This method should output"CLOSED" to the console if the order Number is 9999 otherwise the method should output "OPENED" (5 points) f) Implement a toString method for the Order class that outputs: "The order is named: (name of the order] and the order number is (order number (5 points)

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

Step: 3

blur-text-image

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

1. Signs and symbols of the map Briefly by box ?

Answered: 1 week ago

Question

Types of physical Maps?

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago