Access over 20 million homework & study documents

A Small Manufacturing Company (SMC) uses a Java application for orde

Content type
User Generated
Rating
Showing Page:
1/11
A Small Manufacturing Company (SMC) uses a Java
application for order management. The company accepts
orders and credit orders from their clients. For an order,
the client pays the order value in advance. For credit
orders, the SMC credits the clients with the full dollar
value of the order (in other words, the client should not pay
in advance for the ordered products). For credit orders, the
client and the SMC representatives negotiate the interest
(as percentage of the order value) that will be paid by the
client on top of the order dollar value, when the ordered
items are delivered. The interest value should be between
8 and 25.
You are required to design, implement and test a Java
application for order management consisting of three
classes: Order, CreditOrder and TestOrders. These
classes are specified below. The class Order defines the
instance variables orderId, clientName and orderValue. It
defines a constructor with arguments, the method toString
and and get/set type methods for the instance variables.
The class CreditOrder inherits the class Order. This class
defines the instance variable interest. It also defines a
constructor with arguments, the get/set methods for the
additional instance variable, and the specific methods
toString and getCreditOrderTotalValue.
Additional methods for the classes Order and CreditOrder
may be defined if necessary. The class TestOrders
contains only the method main. Here, you should do the
following:
1. Instantiate an Order object order1 and a CreditOrder
object creditOrder1 by invoking the argument constructors.
Use values of your own as argument values. Display to the
console the string representation of the two objects by
invoking the toString method.
2. Calculate and display the total income of the SMC as a
result of delivering the two orders order1 and creditOrder1.

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/11
3. Instantiate a CreditOrder object creditOrder2 by
invoking the argument constructor. This time, the argument
values will be obtained by inviting the user to enter them
one by one, from the console. Display the string
representation of the object creditOrder2.
4. Check if the two orders creditOrder1 and creditOrder2
are issued by the same client. Display the clients of the
two orders and an appropriate message depending on the
test result.
5. Calculate and display which of the two orders order1 or
creditOrder2 would generate the largest income for the
SMC. Your program should compile and run without errors.
Solution
Order.java
package com.smc;
public class Order {
//Instance Variables
private int orderId;
private String clientName;
protected double orderValue;
//Parameterized Constructor
public Order(int orderId, String clientName, double
orderValue) {

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/11

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 11 pages?
Access Now
Unformatted Attachment Preview
A Small Manufacturing Company (SMC) uses a Java application for order management. The company accepts orders and credit orders from their clients. For an order, the client pays the order value in advance. For credit orders, the SMC credits the clients with the full dollar value of the order (in other words, the client should not pay in advance for the ordered products). For credit orders, the client and the SMC representatives negotiate the interest (as percentage of the order value) that will b e paid by the client on top of the order dollar value, when the ordered items are delivered. The interest value should be between 8 and 25. You are required to design, implement and test a Java application for order management consisting of three classes: Order, CreditOrder and TestOrders. These classes are specified below. The class Order defines the instance variables orderId, clientName and orderValue. It defines a constructor with arguments, the method toString and and get/set type methods for the insta nce variables. The class CreditOrder inherits the class Order. This class defines the instance variable interest. It also defines a constructor with arguments, the get/set methods for the additional instance variable, and the specific methods toString and getCreditOrderTotalValue. Additional methods for the classes Order and CreditOrder may be defined if necessary. The class TestOrders contains only the method main. Here, you should do the following: 1. Instantiate an Order object ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
I use Studypool every time I need help studying, and it never disappoints.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4