Consider the properties or attributes and methods that are related to your product. Using a Unified Modeling Language (UML) class diagram, describe these properties and methods. Consider the properties or attributes that are related to your ordering system. Use a UML class diagram to describe the ordering system class. Be certain to include appropriate get- and set-methods for each of your class properties. Be certain that all of your class instance variables are declared private. All the methods should be declared public.

Create a Java class that implements your UML class diagram for your product. You may place this class in the current Java source file or you may create or add a new file to your project. Modify your existing code to make use of your product class by moving all appropriate variables and methods into the class. You will need to create an instance of your product class in your main method so that your program runs correctly.

Now that your ordering system is constructed in a truly object-oriented manner, you can take advantage of this organization. Consider another product that is similar to your existing product but that has one property or attribute that is somewhat different. As a concrete example, assume that your product has a size property and that the valid values for size are large, medium, and small. A slightly different product might use size values 10”, 15”, 20”, and 25”. These two products would have names: a string. However, the value in the name field would be different for these two different kinds of products. In particular, one is an int and the other is a string.

Complete the following:

Create a base class (also called a superclass) that contains all of the properties that are common to both of these products. Create 2 derived classes (also called subclasses) that contain different kinds of sizes. If your product does not already have a name property, you will need to add one along with appropriate get- and set-methods.
Modify your program so that at an appropriate point in the ordering process, the program requests the name or kind of product. At that point, the correct kind of product class needs to be instantiated. Polymorphism should ensure that the correct kind of size information or method is used.

Modify your program so that it requests 3 products. Create an array of products and save all of the product instances in this array. You might want to think about how an indefinite number of product orders might be handled. However, do not implement this extension for this course.

You will need to change how you handle file output or input. Instead of creating or writing a new file for each product, you need to create an empty file when the program starts. Each new product should then be added to the file. You no longer need to create the confirmation dialog based on data that are read back in after each individual product is ordered. Instead, you will confirm the entire 3-product order after all 3 product orders have been completed. This can be done by reading the order file and displaying or confirming the product orders one after another.
You must revisit your UML diagrams one last time and revise them to represent the final online ordering system in structural diagrams (the class diagrams) and in a behavioral diagram (the use case diagram).

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

Java Classes and UML Diagrams
    $93.00 for this solution

    PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

    Find A Tutor

    View available Java Programming Tutors

    Get College Homework Help.

    Are you sure you don't want to upload any files?

    Fast tutor response requires as much info as possible.

    Upload a file
    Continue without uploading

    We couldn't find that subject.
    Please select the best match from the list below.

    We'll send you an email right away. If it's not in your inbox, check your spam folder.

    • 1
    • 2
    • 3
    Live Chats