public ActionResult ShippingTotal() { Parcel newParcel = new Parcel(); newParcel.SetHeight(int.Parse(Request.Query["height"])); newParcel.SetDepth(int.Parse(Request.Query["depth"])); newParcel.SetWidth(int.Parse(Request.Query["width"])); newParcel.SetWeight(int.Parse(Request.Query["weight"])); int total = newParcel.CostToShip(newParcel.GetHeight(), newParcel.GetDepth(), newParcel.GetWidth(), newParcel.GetWeight()); newParcel.SetTotal(total); if (total == 0) { return(View("ShippingCalc")); } else { return(View("ShippingTotal", newParcel)); } // int height = int.Parse(Request.Query["height"]); // newParcel.SetHeight(height); // int depth = int.Parse(Request.Query["depth"]); // newParcel.SetDepth(depth); // int width = int.Parse(Request.Query["width"]); // newParcel.SetWidth(width); // int weight = int.Parse(Request.Query["weight"]); // newParcel.SetWeight(weight); // int total = newParcel.CostToShip(height, depth, width, weight); // newParcel.SetTotal(total); // return View("ShippingTotal", newParcel); }
public void CostToShip_GetCostOver5Pounds_Int() { Parcel parcel = new Parcel(8, 1, 2, 3); int expectedCost = 9; Assert.AreEqual(expectedCost, parcel.CostToShip()); }
public void CostToShip_CalculatesCost_Price() { Parcel newParcel = new Parcel(1, 1, 1, 1); newParcel.CostToShip(); Assert.AreEqual(1.05, newParcel.Price); }
public ActionResult Create(string contents, int dimensionsH, int dimensionsW, int dimensionsL, int weight) { Parcel myParcel = new Parcel(contents, dimensionsL, dimensionsM, dimensionsS, weight); string myVolume = myParcel.Volume(dimensionsL, dimensionsM, dimensionsS); int myCost = myParcel.CostToShip(myVolume, weight); return(RedirectToAction("Index")); }
public ActionResult Create(int length, int width, int height, int weight, int volume, int cost) { Parcel myParcel = new Parcel(length, width, weight, height); myParcel.CalculateVolume(); myParcel.CostToShip(); return(RedirectToAction("Index")); }
public ActionResult Result(int weight, int length, int width, int height) { Parcel newParcel = new Parcel(weight, length, width, height); newParcel.Volumer(length, width, height); newParcel.CostToShip(); return(View(newParcel)); }
public ActionResult Second(double length, double width, double height) { Parcel myPackage = new Parcel(length, width, height); myPackage.Volume(); double result = myPackage.CostToShip(); // double result = myPackage.CostToShip(); // string results = result.ToString(); myPackage.returnResults(result); return(View("Second", myPackage.returnResults(result))); }
public ActionResult Ship(string weight, string height, string boxlength, string width) { try { if (String.IsNullOrWhiteSpace(weight) || String.IsNullOrWhiteSpace(height) || String.IsNullOrWhiteSpace(boxlength) || String.IsNullOrWhiteSpace(width) || width == "0" || height == "0" || weight == "0" || boxlength == "0") { throw new System.InvalidOperationException("Invalid input"); } else { double doubleHeight = double.Parse(height); double doubleWidth = double.Parse(width); double doubleLength = double.Parse(boxlength); double doubleWeight = double.Parse(weight); Parcel newParcel = new Parcel(doubleHeight, doubleWidth, doubleLength, doubleWeight); newParcel.CostToShip(); return(View(newParcel)); } } catch (Exception ex) { return(View("Error", ex.Message)); } }
public void Parcel_CostToShipPackage() { Parcel newParcel = new Parcel(6, 9, 18); Assert.AreEqual(324, newParcel.CostToShip()); }
public void Parcel_CostToShip() { Parcel newParcel = new Parcel(24, 24, 24); Assert.AreEqual(4608, newParcel.CostToShip()); }
public void Parcel_Volume_CostToShip() { Parcel newParcel = new Parcel(12, 12, 12); Assert.AreEqual(576, newParcel.CostToShip()); }