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":
Order
Description
+ON ORDER: int
+CANCELED: int
+SHIPPED: int
-totalOrder: int
declared as public static final, a constant with value 0
declared as public static final, a constant with value 1
declared as public static final, a constant with value 2
declared as private static, initialized to 0, represent the
total number of orders
total
-orderName: String
private
private
-date: Date
-status: int
private, Date class is defined in the java.util package
private, use ON_ORDER, CANCELED, SHIPPED
constants to represent statuses
private
vittota
private
-shipping Address: String
-phoneNumber: String
-billingAddress: String
+Order(Name: String)
private
private
totalOrder += 1
orderName = Name
status = ON_ORDER
date = new Date()
+cancel(): void
set the cancel date by date = new Date(), status is set to
CANCELED
+ship(): void
set the shipping date by date = new Date(), status is set
to SHIPPED
+setShippingAddress (a: String): void
+setPhoneNumber(p: String): void
+setBillingAddress(add: String): void
+getTotalOrder(): int
shippingAddress = a
phoneNumber=p
billingAddress=add
return totalOrder
return orderName
+getOrderName(): String
+getDate(): Date
return the date (it might be the order date, or shipping
date, or cancel date depending on the status)
+getStatus(): int
return status
+getShippingAddress(): String
return shippingAddress
return phoneNumber
+getPhoneNumber(): String
+getBillingAddress(): String
+toString(): String
return billingAddress
return the information of orderName, date, status,
shipping Address, billingAddress, and phoneNumber as a
String
Note that for each order, there are three statuses.
(1) When a new order is generated in the system, the status is set to "ON_ORDER" and the current system time is put in the "date"
field.
(2) When the "cancel" operation occurs, the status is set to "CANCELED" and the current system time is put in the "date" field.
(3) When the "ship" operation occurs, the status is set to "SHIPPED" and the current system time is put in the "date" field.
Implement the Order class in a file named Order.java.
Write a test program named TestOrder.java with a main method that creates 3 Order objects and try all methods in the class. Print out
these 3 objects as the following format:
Order Name Date Status
Shipping Address Billing Address
Phone Number
Transcribed Image Text:UML for class "Order": Order Description +ON ORDER: int +CANCELED: int +SHIPPED: int -totalOrder: int declared as public static final, a constant with value 0 declared as public static final, a constant with value 1 declared as public static final, a constant with value 2 declared as private static, initialized to 0, represent the total number of orders total -orderName: String private private -date: Date -status: int private, Date class is defined in the java.util package private, use ON_ORDER, CANCELED, SHIPPED constants to represent statuses private vittota private -shipping Address: String -phoneNumber: String -billingAddress: String +Order(Name: String) private private totalOrder += 1 orderName = Name status = ON_ORDER date = new Date() +cancel(): void set the cancel date by date = new Date(), status is set to CANCELED +ship(): void set the shipping date by date = new Date(), status is set to SHIPPED +setShippingAddress (a: String): void +setPhoneNumber(p: String): void +setBillingAddress(add: String): void +getTotalOrder(): int shippingAddress = a phoneNumber=p billingAddress=add return totalOrder return orderName +getOrderName(): String +getDate(): Date return the date (it might be the order date, or shipping date, or cancel date depending on the status) +getStatus(): int return status +getShippingAddress(): String return shippingAddress return phoneNumber +getPhoneNumber(): String +getBillingAddress(): String +toString(): String return billingAddress return the information of orderName, date, status, shipping Address, billingAddress, and phoneNumber as a String Note that for each order, there are three statuses. (1) When a new order is generated in the system, the status is set to "ON_ORDER" and the current system time is put in the "date" field. (2) When the "cancel" operation occurs, the status is set to "CANCELED" and the current system time is put in the "date" field. (3) When the "ship" operation occurs, the status is set to "SHIPPED" and the current system time is put in the "date" field. Implement the Order class in a file named Order.java. Write a test program named TestOrder.java with a main method that creates 3 Order objects and try all methods in the class. Print out these 3 objects as the following format: Order Name Date Status Shipping Address Billing Address Phone Number
Please note that Order 2 and Order 3 in the output below are supposed to occupy one line 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
Transcribed Image Text:Please note that Order 2 and Order 3 in the output below are supposed to occupy one line 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
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