I have already written the program and have it right, but I need help write print statement for the testorder class so that the display result looks as shown in the images. I am having trouble getting that right. I will paste the program below so you can run it  and attatch the image of display result. Program for Order Class: package homework; import java.util.Date; public class Order { //Declare final variables            public static final int ON_ORDER = 0;      public static final int CANCELLED = 1;      public static final int SHIPPED = 2; //Declare local variables            private int totalOrder;      private String orderName;      private Date date;      private int status;      private String shippingAddress;      private String phoneNumber;      private String billingAddress; //Constructor           public Order(String name) {                    this.totalOrder += 1;          this.orderName = name;          this.status = ON_ORDER;          this.date = new Date(); } //Cancel the placed order            public void cancel() {              this.status = CANCELLED;              this.date = new Date(); } //Ship the placed order            public void ship() {              this.status = SHIPPED;              this.date = new Date();      }      //Set data feilds       public void setShippingAddress(String a) {             this.shippingAddress = a; } public void setPhoneNumber(String p) {        this.phoneNumber = p; } public void setBillingAddress(String billingAddress) {        this.billingAddress = billingAddress; } //Get data fields public int getTotalOrder() {        return totalOrder; } public String getOrderName() {        return orderName; } public Date getDate() {        return date; } public int getStatus() {        return status; } public String getShippingAddress() {        return shippingAddress; } public String getPhoneNumber() {        return phoneNumber; } public String getBillingAddress() {        return billingAddress; } public String toString() {        return this.orderName + "\t" + this.date + "\t" + this.status + "\t" + this.shippingAddress + "\t"        + this.billingAddress + "\t" + this.phoneNumber; } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I have already written the program and have it right, but I need help write print statement for the testorder class so that the display result looks as shown in the images. I am having trouble getting that right. I will paste the program below so you can run it  and attatch the image of display result.

Program for Order Class:

package homework;

import java.util.Date;

public class Order {

//Declare final variables
     
     public static final int ON_ORDER = 0;
     public static final int CANCELLED = 1;
     public static final int SHIPPED = 2;

//Declare local variables
     
     private int totalOrder;
     private String orderName;
     private Date date;
     private int status;

     private String shippingAddress;
     private String phoneNumber;
     private String billingAddress;

//Constructor
    
     public Order(String name) {
         
         this.totalOrder += 1;
         this.orderName = name;
         this.status = ON_ORDER;
         this.date = new Date();
}

//Cancel the placed order
     
     public void cancel() {
             this.status = CANCELLED;
             this.date = new Date();
}

//Ship the placed order
     
     public void ship() {
             this.status = SHIPPED;
             this.date = new Date();
     }

    
//Set data feilds
     
public void setShippingAddress(String a) {
            this.shippingAddress = a;
}

public void setPhoneNumber(String p) {
       this.phoneNumber = p;
}

public void setBillingAddress(String billingAddress) {
       this.billingAddress = billingAddress;
}

//Get data fields

public int getTotalOrder() {
       return totalOrder;
}

public String getOrderName() {
       return orderName;
}

public Date getDate() {
       return date;
}

public int getStatus() {
       return status;
}

public String getShippingAddress() {
       return shippingAddress;
}

public String getPhoneNumber() {
       return phoneNumber;
}

public String getBillingAddress() {
       return billingAddress;
}

public String toString() {
       return this.orderName + "\t" + this.date + "\t" + this.status + "\t" + this.shippingAddress + "\t"
       + this.billingAddress + "\t" + this.phoneNumber;

}
}

 

 

 

### UML for Class "Order"

#### Class Diagram and Descriptions

This UML class diagram details the structure and behavior of the `Order` class. Below is an explanation of each component present in the class.

#### Attributes

- **ON_ORDER**: `public static final int`
  - Represents the initial status of an order (value: 0).

- **CANCELED**: `public static final int`
  - Represents the status when an order is canceled (value: 1).

- **SHIPPED**: `public static final int`
  - Represents the status when an order is shipped (value: 2).

- **totalOrder**: `private static int`
  - Keeps a count of the total number of orders.

- **orderName**: `private String`
  - The name of the order.

- **date**: `private Date`
  - Represents the date associated with the order (where Date is part of `java.util` package).

- **status**: `private int`
  - Tracks the status of the order, uses constants: `ON_ORDER`, `CANCELED`, `SHIPPED`.

- **shippingAddress**: `private String`
  - The shipping address of the order.

- **phoneNumber**: `private String`
  - The phone number associated with the order.

- **billingAddress**: `private String`
  - The billing address for the order.

#### Constructors

- **Order (Name: String)**
  - Initializes the order with the given name, increments `totalOrder` by 1, sets the status to `ON_ORDER`, and assigns the current date.

#### Methods

- **cancel(): void**
  - Sets the order's status to `CANCELED` and updates the date to the current date.

- **ship(): void**
  - Sets the order's status to `SHIPPED` and updates the date to the current date.

- **setShippingAddress(a: String): void**
  - Updates the shipping address.

- **setPhoneNumber(p: String): void**
  - Updates the phone number.

- **setBillingAddress(add: String): void**
  - Updates the billing address.

- **getTotalOrder(): int**
  - Returns the total number of orders.

- **getOrderName(): String**
  - Returns the order name.

- **getDate(): Date**
  - Returns the date associated with the order
Transcribed Image Text:### UML for Class "Order" #### Class Diagram and Descriptions This UML class diagram details the structure and behavior of the `Order` class. Below is an explanation of each component present in the class. #### Attributes - **ON_ORDER**: `public static final int` - Represents the initial status of an order (value: 0). - **CANCELED**: `public static final int` - Represents the status when an order is canceled (value: 1). - **SHIPPED**: `public static final int` - Represents the status when an order is shipped (value: 2). - **totalOrder**: `private static int` - Keeps a count of the total number of orders. - **orderName**: `private String` - The name of the order. - **date**: `private Date` - Represents the date associated with the order (where Date is part of `java.util` package). - **status**: `private int` - Tracks the status of the order, uses constants: `ON_ORDER`, `CANCELED`, `SHIPPED`. - **shippingAddress**: `private String` - The shipping address of the order. - **phoneNumber**: `private String` - The phone number associated with the order. - **billingAddress**: `private String` - The billing address for the order. #### Constructors - **Order (Name: String)** - Initializes the order with the given name, increments `totalOrder` by 1, sets the status to `ON_ORDER`, and assigns the current date. #### Methods - **cancel(): void** - Sets the order's status to `CANCELED` and updates the date to the current date. - **ship(): void** - Sets the order's status to `SHIPPED` and updates the date to the current date. - **setShippingAddress(a: String): void** - Updates the shipping address. - **setPhoneNumber(p: String): void** - Updates the phone number. - **setBillingAddress(add: String): void** - Updates the billing address. - **getTotalOrder(): int** - Returns the total number of orders. - **getOrderName(): String** - Returns the order name. - **getDate(): Date** - Returns the date associated with the order
### Example Order Data Output 

**Note:** The information for Order 2 and Order 3 in the output below are intended to occupy one line each during execution.

```
Order 2's Name: Two Cars
Order 3's Date: Mon May 24 11:49:04 EDT 2021
Order 2's Status: 2
Order 3's Shipping Address: 123 Ave Street
Order 2's Billing Address: 255 Counts Lane
Order 3's Number: (999)-999-9999
The number of orders is: 3

Order Name: One PC| Date: Mon May 24 11:49:04 EDT 2021| Status: 1| Shipping Address: null| Billing Address: null| Phone Number: null
Order Name: Two Cars| Date: Mon May 24 11:49:04 EDT 2021| Status: 2| Shipping Address: 91 Oliverio Drive| Billing Address: 255 Counts Lane| Phone Number: (620)-562-5212
Order Name: Three Baskets| Date: Mon May 24 11:49:04 EDT 2021| Status: 0| Shipping Address: 123 Ave Street| Billing Address: 67 North Lane| Phone Number: (999)-999-9999
```

### Explanation:

This output represents a structured format of order data commonly seen in databases or inventory systems. Each order is characterized by several attributes:
- **Order Name:** The name or description of the item(s) ordered.
- **Date:** The date and time when the order was placed.
- **Status:** An indicator of the order's current state (e.g., 0 might mean order received, 1 may indicate processing, and 2 may indicate dispatched).
- **Shipping Address:** The address where the items are to be shipped.
- **Billing Address:** The address used for billing purposes.
- **Phone Number:** The contact number associated with the order.

**Graphical Representation:**
The textual data is contained within a bordered box, ensuring clarity. It highlights the importance of precise data representation and well-structured output formatting in educational settings. This structured manner helps decipher multiple entries systematically and comprehend the detailed attributes of each order concisely.

### Practical Implications:
Understanding this structural breakdown can help students in subjects related to database management, software engineering, and order processing systems. It exemplifies how
Transcribed Image Text:### Example Order Data Output **Note:** The information for Order 2 and Order 3 in the output below are intended to occupy one line each during execution. ``` Order 2's Name: Two Cars Order 3's Date: Mon May 24 11:49:04 EDT 2021 Order 2's Status: 2 Order 3's Shipping Address: 123 Ave Street Order 2's Billing Address: 255 Counts Lane Order 3's Number: (999)-999-9999 The number of orders is: 3 Order Name: One PC| Date: Mon May 24 11:49:04 EDT 2021| Status: 1| Shipping Address: null| Billing Address: null| Phone Number: null Order Name: Two Cars| Date: Mon May 24 11:49:04 EDT 2021| Status: 2| Shipping Address: 91 Oliverio Drive| Billing Address: 255 Counts Lane| Phone Number: (620)-562-5212 Order Name: Three Baskets| Date: Mon May 24 11:49:04 EDT 2021| Status: 0| Shipping Address: 123 Ave Street| Billing Address: 67 North Lane| Phone Number: (999)-999-9999 ``` ### Explanation: This output represents a structured format of order data commonly seen in databases or inventory systems. Each order is characterized by several attributes: - **Order Name:** The name or description of the item(s) ordered. - **Date:** The date and time when the order was placed. - **Status:** An indicator of the order's current state (e.g., 0 might mean order received, 1 may indicate processing, and 2 may indicate dispatched). - **Shipping Address:** The address where the items are to be shipped. - **Billing Address:** The address used for billing purposes. - **Phone Number:** The contact number associated with the order. **Graphical Representation:** The textual data is contained within a bordered box, ensuring clarity. It highlights the importance of precise data representation and well-structured output formatting in educational settings. This structured manner helps decipher multiple entries systematically and comprehend the detailed attributes of each order concisely. ### Practical Implications: Understanding this structural breakdown can help students in subjects related to database management, software engineering, and order processing systems. It exemplifies how
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY