コード例 #1
0
 // Precondition:  None
 // Postcondition: A string is returned presenting the details of the package
 public override string ToString()
 {
     return("Orgin: " + OrginZip.ToString("D5") + System.Environment.NewLine
            + "Destination: " + DestinationZip.ToString("D5") + System.Environment.NewLine +
            "Length: " + Length.ToString("F1") + System.Environment.NewLine + "Width: " + Width.ToString("F1")
            + System.Environment.NewLine + "Height: " + Height.ToString("F1") + System.Environment.NewLine +
            "Weight: " + Weight.ToString("F1")); // return the details of package as a string
 }
コード例 #2
0
 //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): ###
 }
コード例 #3
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
コード例 #4
0
        // 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());
        }
コード例 #5
0
        //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);
        }
コード例 #6
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")));
        }
コード例 #7
0
ファイル: GroundPackage.cs プロジェクト: ptwarr44/CIS199
 //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.
 }
コード例 #8
0
ファイル: GroundPackage.cs プロジェクト: rmlogu01/CIS199
 //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);
 }
コード例 #9
0
ファイル: GroundPackage.cs プロジェクト: rorive01/CIS199
        public override string ToString()
        {
            string packageData; // holds package details

            packageData = "Origen Zip Code:" + OrigenZip.ToString("D5") + System.Environment.NewLine + "Destination Zip Code:" + DestinationZip.ToString("D5") + System.Environment.NewLine + "Zone Distance:" + ZoneDistance.ToString() + System.Environment.NewLine + "Length:" + Length.ToString() + System.Environment.NewLine + "Width: " + Width.ToString() + System.Environment.NewLine + "Height:" + Height.ToString() + System.Environment.NewLine + "Weight:" + Weight.ToString();
            return(packageData);
        }
コード例 #10
0
 // 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());
 }