//Preconditions: none
        //Postconditions:
        //A text string of originZip, destZip, length, width, height, and weight will be created and returned as a string.
        //each property of the package will be displayed on its own line of text.
        public override string ToString()
        {
            string result = "Origin Zip: " + OriginZip.ToString() + System.Environment.NewLine + "Dest Zip: " + DestZip.ToString() + System.Environment.NewLine
                            + "Weight: " + Weight.ToString() + System.Environment.NewLine + "Length: " + Length.ToString() + System.Environment.NewLine + "Width: " + Width.ToString()
                            + System.Environment.NewLine + "Height: " + Height.ToString();

            return(result);
        }
Exemple #2
0
 public override string ToString()
 {
     // Precondition:  None
     // Postcondition: A string is returned representing the GroundPackage in form
     //                all values displayed in separate lines
     return("Origin Zip:" + OriginZip.ToString("D4") + "/n" + "Destination Zip:" + DestinZip.ToString("D4")
            + "/n" + "Length:" + Length.ToString("") + "/n" + "Width:" + Width.ToString("")
            + "/n" + "Height:" + Height.ToString("") + "/n" + "Weight:" + Weight.ToString(""));
 }
 //Precondition: None
 //Postcondition: a string is returned in a new format
 public override string ToString()
 {                                                                                                       //  Changes the previous ToString format to:
     return("Origin Zip Code: " + OriginZip.ToString("D5") + System.Environment.NewLine +                //
            "Destination Zip Code: " + DestinationZip.ToString("D5") + System.Environment.NewLine +      // Origin Zip Code: #####
            "Length (inches): " + Length.ToString() + System.Environment.NewLine +                       // Destination Zip Code: #####
            "Width (inches): " + Width.ToString() + System.Environment.NewLine +                         // Length (inches): ###
            "Height (inches): " + Height.ToString() + System.Environment.NewLine +                       // Width (inches): ###
            "Weight (pounds): " + Weight.ToString());                                                    // Height (inches): ###
                                                                                                         // Weight (pounds): ###
 }
Exemple #4
0
        }     //end ZoneDistance property

        //ToString Method
        //Precondition: Each variable has been assigned a valid value
        //Postcondition: A string is returned that displays all of the values on separate lines
        public override string ToString()
        {
            string result =
                "Origin Zip:" + " " + OriginZip.ToString("D5") + System.Environment.NewLine + "Destination Zip:" + " " +
                DestinationZip.ToString("D5") + " " + System.Environment.NewLine + "Length:" + " " + Length.ToString() +
                System.Environment.NewLine + "Width:" + " " + Width.ToString() + System.Environment.NewLine + "Height:" +
                " " + Height.ToString() + System.Environment.NewLine + "Weight:" + " " + Weight.ToString() +
                System.Environment.NewLine;

            return(result);
        } //end method
        // Precondition:  None
        // Postcondition: A string is returned presenting the date in US format
        public override string ToString()
        {
            string result; // builds the output for for the date

            return(result = "Origin Zip: " + OriginZip.ToString("D5") + System.Environment.NewLine +
                            "Destination Zip: " + DestinationZip.ToString("D5") + System.Environment.NewLine +
                            "Length: " + Length.ToString() + System.Environment.NewLine +
                            "Width: " + Width.ToString() + System.Environment.NewLine +
                            "Height: " + Height.ToString() + System.Environment.NewLine +
                            "Weight " + Weight.ToString());
        }
        //Precondition: none
        //Postcondition: converts values for above properties to strings and concactenates them
        public override string ToString()
        {
            string oz  = "Origin Zip: " + OriginZip.ToString("D5");
            string dz  = "Destination Zip: " + DestinationZip.ToString("D5");
            string l   = "Length: " + Length.ToString() + " " + "inches";
            string w   = "Width: " + Width.ToString() + " " + "inches";
            string h   = "Height: " + Height.ToString() + " " + "inches";
            string zd  = "Zone Distance: " + ZoneDistance.ToString();
            string lbs = "Weight: " + Weight.ToString() + " " + "pounds";

            return(oz + System.Environment.NewLine + dz + System.Environment.NewLine + zd + System.Environment.NewLine + l + System.Environment.NewLine + w + System.Environment.NewLine + h + System.Environment.NewLine + lbs);
        }
Exemple #7
0
        //Tostring method for formatting package properties, overrides default tostring property.
        //Precondition: none
        //Postcondtion: a string for the package is returned.
        public override string ToString()
        {
            string nl = Environment.NewLine; //shortcut for new line function

            return(string.Format("Origin Zip: {1}{0}", nl, OriginZip.ToString("d5")) +
                   string.Format("Destination Zip: {1}{0}", nl, DestinationZip.ToString("d5")) +
                   string.Format("Length: {1}{0}", nl, Length) +
                   string.Format("Width: {1}{0}", nl, Width) +
                   string.Format("Heigth: {1}{0}", nl, Height) +
                   string.Format("Weight: {1}{0}", nl, Weight) +
                   string.Format("Zone Distance: {1}{0}", nl, ZoneDistance) +
                   string.Format("Cost: {1}{0}", nl, CalcCost().ToString("C")));
        }
Exemple #8
0
 //Precondition: None
 //Postcondition: Formatted string representing a ground package
 public override string ToString()
 {
     return(string.Format("Origin Zip: " + OriginZip.ToString() + "{0}" +
                          "Destination Zip: " + DestinationZip.ToString() + "{1}" +
                          "Length: " + _length.ToString("F2") + " in" + "{2}" +
                          "Width: " + _width.ToString("F2") + " in" + "{3}" +
                          "Height: " + _height.ToString("F2") + " in" + "{4}" +
                          "Weight: " + _weight.ToString("F2") + " lb(s)" + "{5}" +
                          //"Distance between: " + ZoneDistance.ToString() + "{2}" +
                          "Total Cost: " + CalcCost().ToString("C2") + "{6}",
                          Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine,
                          Environment.NewLine, Environment.NewLine, Environment.NewLine)); //Displays the Zip codes, total distance, and total cost.
 }
Exemple #9
0
 //ToString Method
 //Precondition: All the value calculated are valid and all properties have values
 //Postcondition: A messagebox is displayed with all of the values formatted
 public override string ToString()
 {
     return("Origin ZIP: " + OriginZip.ToString("D5") + Environment.NewLine + "Destination ZIP: " + DestinationZip.ToString("D5") + Environment.NewLine
            + "Length: " + Length + Environment.NewLine + "Width: " + Width + Environment.NewLine + "Height: " + Height +
            Environment.NewLine + "Weight: " + Weight);
 }
 // Precondition: None
 // Postcondition: Returns all of the data about the package, each on a seperated line
 public override string ToString()
 {
     return("Origin Zip: " + OriginZip.ToString("D5") + System.Environment.NewLine + "Destination Zip: " + DestinationZip.ToString("D5") + System.Environment.NewLine + "Length: " + Length.ToString() + System.Environment.NewLine + "Width: " + Width.ToString() + System.Environment.NewLine + "Height: " + Height.ToString() + System.Environment.NewLine + "Weight: " + Weight.ToString());
 }