405023 Java project using Inheritance
- Status Closed
- Budget N/A
- Total Bids 43
Please visit this link to see what this project requires:
[url removed, login to view]
The purpose of this assignment is to create a Java applet that uses inheritance and overridden methods. The applet will process order information. An order may be shipped or picked up. There is an additional shipping and handling charge if the order is shipped. The project is based on an exercise in the textbook Java Programming by Joyce Farrell.
1. Create an applet that uses three classes. The classes will be named Order, ShippedOrder, and UseOrder.
2. The Order class will have four private instance variables. These variables will be for the customer name (String), the customer number (integer), the order quantity (double) and the unit cost (double). The Order class will have the following instance methods - get/set customer name, get/set customer number, get/set order quantity, get/set unit cost. The Order class will also have a computePrice instance method. This method should return the result of multiplying the order quantity times the unit cost. The computePrice() method cannot have any arguments passed to it.
3. The ShippedOrder class will be a subclass of the Order class. This class will have one new private instance variable. This instance variable will store a shipping and handling charge. Set the shipping and handling charge to a constant $4. The ShippedOrder class will have one new method. This method must be named computePrice and it must override the computePrice method in the Order superclass. The computePrice method in the ShippedOrder class should return the order cost (quantity times unit cost plus the shipping and handling charge).
4. Make sure the user can change the data on the screen and create another order of the same or an order of a different type. No additional components should be displayed under these circumstances.
5. Include the html for the applet tag as a comment in your source code. This html will be graded as part of the assignment.
6. The UseOrder class will be the applet. Use a GridLayout layout manager to position the appropriate components as illustrated in the example below.
The initial user interface with JTextField objects for the customer name, customer number, order quantity, and unit cost.
7. The applet should allow the user to enter data for the customer name, customer number, order quantity, and unit cost as illustrated in the example below.
Applet form with completed user input for the order.
7. The user can then click the "Display Shipped Order" button to create an object of the ShippedOrder class or click the "Display Order" button to create an object of the Order class. After the appropriate object is created, print all the values of the instance variables and the order's total cost. You must use the get methods to retrieve the values from the object and you must use the computePrice method to "retrieve" the order's total cost. The output for a shipped order would look like the example below. Make sure you can also display the same information for a order object (not shipped). The "output information" at the bottom of the window must be in a different foreground color.
Applet form with completed data for the order.
Figure 3Get free quotes for a project like this
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online