コード例 #1
0
    function costToShip()
    {
        return 0.0015 * ($this->volume() * $this->weight);
    }
}
$partyParcel = new Parcel($_GET["height"], $_GET["width"], $_GET["length"], $_GET["weight"]);
?>

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
    <title>PACKAGE INFO</title>
</head>
<body>
    <?php 
if (empty($partyParcel->getHeight()) || empty($partyParcel->getWidth()) || empty($partyParcel->getLength()) || empty($partyParcel->getWeight())) {
    echo "You missed a parameter";
} else {
    echo "<h1>HEIGHT: " . $partyParcel->getHeight() . "</h1>";
    echo "<h1>WIDTH: " . $partyParcel->getWidth() . "</h1>";
    echo "<h1>LENGTH: " . $partyParcel->getLength() . "</h1>";
    echo "<h1>WEIGHT: " . $partyParcel->getWeight() . "</h1>";
    echo "<h1>VOLUME: " . $partyParcel->volume() . "</h1>";
    setlocale(LC_MONETARY, 'en_US');
    echo "<h1>COST 2 SHIP: " . money_format('%(#1n', $partyParcel->costToShip()) . "</h1>";
}
?>
</body>
</html>
コード例 #2
0
    } elseif ($_GET[$property] == "") {
        die("{$property} was not defined");
    }
}
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Parcel Printout</title>
  </head>
  <body>
    <?php 
$customer_parcel = new Parcel($_GET["length"], $_GET["width"], $_GET["height"], $_GET["weight"]);
$length = $customer_parcel->getLength();
$width = $customer_parcel->getWidth();
$height = $customer_parcel->getHeight();
$weight = $customer_parcel->getWeight();
$volume = $customer_parcel->volume();
$cost = $customer_parcel->costToShip();
echo "<p> Parcel length: {$length} </P>";
echo "<p> Parcel width: {$width} </P>";
echo "<p> Parcel height: {$height} </P>";
echo "<p> Parcel weight: {$weight} </P>";
echo "<p> Parcel volume: {$volume} </P>";
echo "<p> Parcel cost: \${$cost} </P>";
?>
  </body>
</html>
コード例 #3
0
}
$shoes = new Parcel(0, 0, 0, 0);
$shoes->setLength($_GET["length"]);
$shoes->setWidth($_GET["width"]);
$shoes->setHeight($_GET["height"]);
$shoes->setWeight($_GET["weight"]);
?>
<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
    <title>Parcel shipping cost</title>
</head>
<body>
    <div class="container">
        <h1>Shipping cost:</h1>
        <?php 
if (empty($shoes->getLength()) || empty($shoes->getWidth()) || (empty($shoes->getHeight()) || empty($shoes->getWeight()))) {
    echo "<p>Please complete empty fields.</p>";
} else {
    echo "<p> Length: " . $shoes->getLength() . " inches.</p>";
    echo "<p> Width: " . $shoes->getWidth() . " inches. </p>";
    echo "<p> Height: " . $shoes->getHeight() . " inches. </p>";
    echo "<p> Weight: " . $shoes->getWeight() . " pounds. </p>";
    echo "<p> Volume: " . $shoes->volume() . " cubed inches. </p>";
    echo "<p> Cost to ship: \$" . $shoes->costToShip() . "</p>";
}
?>
    </div>
</body>
</html>
コード例 #4
0
ファイル: parcels.php プロジェクト: alexdbrown/parcels
        return $this->height;
    }
    function setWeight($new_weight)
    {
        $this->weight = $new_weight;
    }
    function getWeight()
    {
        return $this->weight;
    }
}
$user_parcel = new Parcel($_GET["length"], $_GET["width"], $_GET["height"], $_GET["weight"]);
?>

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  <title>Parcel Results!</title>
</head>
<body>
  <h1>Here are the results of your parcel inqury</h1>
  <?php 
echo $user_parcel->getLength();
echo $user_parcel->getWidth();
echo $user_parcel->getHeight();
echo $user_parcel->getWeight();
?>
</body>
</html>
コード例 #5
0
ファイル: parcels.php プロジェクト: milleraundra/parcel
$parcel->setWeight($_GET["weight"]);
?>

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>
    <h1>Parcel</h1>
    <ul>
        <?php 
$parcel_height = $parcel->getHeight();
$parcel_width = $parcel->getWidth();
$parcel_length = $parcel->getLength();
$parcel_volume = $parcel->volume($parcel_height, $parcel_width, $parcel_length);
$parcel_weight = $parcel->getWeight();
$parcel_cost = $parcel->costToShip($parcel_volume, $parcel_weight);
$parcel_info = array($parcel_height, $parcel_width, $parcel_length, $parcel_weight);
foreach ($parcel_info as $input) {
    $completed = 0;
    if ($input == 0) {
        $completed = $completed + 1;
    } else {
        $completed = $completed;
    }
}
if ($completed != 0) {
    echo "<h2>Please fill in all form fields.</h2>";
コード例 #6
0
ファイル: app.php プロジェクト: alexMcosta/epicodusDay2
    $first_parcel->setLength($_GET["length"]);
    $first_parcel->setWidth($_GET["width"]);
    $first_parcel->setHeight($_GET["height"]);
    ?>
      <title>Answers</title>

      <h1> Here are the answers below: </h1>

<?php 
    $first_parcel_length = $first_parcel->getLength();
    if ($first_parcel->getlength() == 0) {
        echo "<p>Length: A number please!</p>";
    } else {
        echo "<p>Length: {$first_parcel_length} (ft)</p>";
    }
    $first_parcel_width = $first_parcel->getWidth();
    if ($first_parcel->getWidth() == 0) {
        echo "<p>Width: A number please!</p>";
    } else {
        echo "<p>Width: {$first_parcel_width} (ft)</p>";
    }
    $first_parcel_height = $first_parcel->getHeight();
    if ($first_parcel->getHeight() == 0) {
        echo "<p>Height: A number please!</p>";
    } else {
        echo "<p>Height: {$first_parcel_height} (ft)</p>";
    }
    $first_parcel_weight = $first_parcel->getWeight();
    if ($first_parcel->getWeight() == 0) {
        echo "<p>Weight: A number please!</p>";
    } else {
コード例 #7
0
ファイル: parcels.php プロジェクト: netzeln/parcels
        return $this->weight;
    }
}
$newParcel = new Parcel($_GET['height'], $_GET['width'], $_GET['length'], $_GET['weight']);
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Parcels</title>
  </head>
  <body>
      <h1>Your Parcel Details:</h1>
      <?php 
if ($newParcel->getHeight() > 0 && $newParcel->getWidth() > 0 && $newParcel->getLength() > 0 && $newParcel->getWeight() > 0) {
    $show_height = $newParcel->getHeight();
    $show_width = $newParcel->getWidth();
    $show_length = $newParcel->getLength();
    $show_weight = $newParcel->getWeight();
    $show_volume = $newParcel->volume();
    $show_cost = $newParcel->costToShip();
    echo "<p>Your package is {$show_height} High, {$show_width} Wide, {$show_length} Long, {$show_weight} Heavy</p>";
    echo "<p>The volume is {$show_volume}</p>";
    echo "<p>Shipping cost is: {$show_cost}</p>";
} else {
    echo "<p> Something is wrong</p>";
}
?>
  </body>
</html>
コード例 #8
0
ファイル: parcel.php プロジェクト: bborealis/parcel
        $total_volume = $this->volume();
        return $total_volume * $this->weight / 100000;
    }
}
$new_parcel = new Parcel($_GET["length"], $_GET["height"], $_GET["width"], $_GET["weight"]);
?>

<!DOCTYPE html>
<html>
<head>
    <title>Parcel Shipping Cost Homepage</title>
</head>
<body>
    <h1>Your Parcel Shipping Cost</h1>
    <ul>
      <?php 
$total_length = $new_parcel->getLength();
$total_height = $new_parcel->getHeight();
$total_width = $new_parcel->getWidth();
$total_weight = $new_parcel->getWeight();
$total_volume = $new_parcel->volume();
$total_cost = $new_parcel->costToShip();
echo "<li> Cost: \${$total_cost} </li>";
echo "<li> Volume: {$total_volume} cubic inches  </li>";
echo "<li> Dimensions: {$total_length} X {$total_height} X {$total_width} inches </li>";
echo "<li> Weight: {$total_weight} pounds</li>";
?>
    </ul>
</body>
</html>
コード例 #9
0
ファイル: parcel.php プロジェクト: mostfamiliar/parcel
    }
}
$my_parcel = new Parcel($_GET["width"], $_GET["length"], $_GET["height"], $_GET["weight"]);
?>

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <title>Shipping Cost</title>
</head>
<body>
    <div class="container">
    <?php 
$shippingCost = $my_parcel->costToShip();
$parcelWidth = $my_parcel->getWidth();
$parcelLength = $my_parcel->getLength();
$parcelHeight = $my_parcel->getHeight();
$parcelWeight = $my_parcel->getWeight();
if ($parcelWidth == "" || $parcelLength == "" || $parcelHeight == "" || $parcelWeight == "") {
    echo "<h1>Please fill out all fields!</h1>";
} else {
    echo "<h1>This will be your shipping cost:</h1>";
    echo "<h3>\${$shippingCost}</h3>";
    echo "<h4>Your package:</h4>";
    echo "<p>Width: {$parcelWidth}</p>";
    echo "<p>Length: {$parcelLength}</p>";
    echo "<p>Height: {$parcelHeight}</p>";
    echo "<p>Weight: {$parcelWeight}</p>";
}
?>
コード例 #10
0
    <form action="parcel.php">
      <label for="length">Length</label>
      <input id="length" name="length" type="number">
      <label for="width">Width</label>
      <input id="width" name="width" type="number">
      <label for="height">Height</label>
      <input id="height" name="height" type="number">
      <label for="weight">Weight</label>
      <input id="weight" name="weight" type="number">
      <button type="submit">Calculate Cost</button>
    </form>
    <div>
      <h3>Your Parcel:</h3>
      <ul><?php 
$curLength = $parcel->getLength();
$curWidth = $parcel->getWidth();
$curHeight = $parcel->getHeight();
$curWeight = $parcel->getWeight();
$curVolume = $parcel->volume();
$curCost = $parcel->costToShip();
if ($curLength && $curWidth && $curHeight && $curWeight && $curVolume && $curCost) {
    echo "<li>Length: {$curLength} </li>";
    echo "<li>Width: {$curWidth} </li>";
    echo "<li>Height: {$curHeight} </li>";
    echo "<li>Weight: {$curWeight} </li>";
    echo "<li>Volume: {$curVolume} </li>";
    echo "<li>Total Cost: {$curCost} </li>";
} else {
    echo "<p>Please enter a value for all fields</p>";
}
?>
コード例 #11
0
ファイル: parcel.php プロジェクト: eddieduro/parcel-php
$new_parcel->setWeight($weight);
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">
  </head>
  <body>
    <div class="container">
      <ul>
        <?php 
$new_height = $new_parcel->getHeight();
$new_width = $new_parcel->getWidth();
$new_weight = $new_parcel->getWeight();
if (!$new_weight || !$new_height || !$new_width) {
    echo "Please fill out the form completely.";
} else {
    echo "<li> Height: {$new_height} </li>";
    echo "<li> Width: {$new_width} </li>";
    echo "<li> Weight: {$new_weight} </li>";
    $volume = $new_parcel->volume();
    echo "<li> Volume: {$volume} </li>";
    $shipping_cost = $new_parcel->callToShip();
    echo "<p> Shipping Total:" . "\$" . $shipping_cost . "</p>";
}
?>
      </ul>
    </div>
コード例 #12
0
ファイル: parcel.php プロジェクト: boloround/parcel
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="col-sm-6">
                    <h1>Your parcel:</h1>
                    <ul>
                        <?php 
if (!$isParcel) {
    echo "<h3>Please add a numerical value for " . $error . ".</h3>";
} else {
    $dim_price = money_format('%(#10.2n', $your_parcel->costToShip());
    echo "<li>Length: " . $your_parcel->getLength() . "</li>\n";
    echo "<li>Width: " . $your_parcel->getWidth() . "</li>\n";
    echo "<li>Height: " . $your_parcel->getHeight() . "</li>\n";
    echo "<li>Weight: " . $your_parcel->getWeight() . "</li>\n";
    echo "<li><strong>Volume: " . $your_parcel->volume() . "</strong></li>\n";
    echo "<li>Total Cost:" . $dim_price . "</li>\n";
}
?>
                    </ul>
                </div>
                <div class="col-sm-6">
                    <?php 
if (!$isParcel) {
    echo "<img class='img-responsive hidden' src='images/box.jpg'>";
} else {
    echo "<img class='img-responsive' src='images/box.jpg'>";
}
コード例 #13
0
ファイル: parcels.php プロジェクト: aftondowney/parcels
?>

<!DOCTYPE html>
<html>
<head>
    <title>Pricing</title>
</head>
<body>
    <h1>Here is yo shipping cost</h1>
    <?php 
$object = new Parcel($_GET["height"], $_GET["length"], $_GET["width"], $_GET["weight"]);
$object_volume = $object->volume();
$object_weight = $object->getWeight();
$finalPrice = $object->totalPrice();
$object_height = $object->getHeight();
$object_width = $object->getWidth();
$object_length = $object->getLength();
if ($object_volume == 0 || $object_weight == 0) {
    echo "Please make sure all fields are completed.";
}
?>
    <p>Volume of package: <?php 
echo $object_volume . " square inches" . " (" . $object_height . "in x " . $object_length . "in x " . $object_width . "in)";
?>
</p>
    <p>Weight: <?php 
echo $object_weight . " oz";
?>
</p>
    <p>Total: <?php 
echo '$' . $finalPrice;
コード例 #14
0
    }
    function getVolume()
    {
        return $this->length * $this->width * $this->height;
    }
}
?>

<html>
    <head>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
        <title>Parcel Results</title>
    </head>
    <body>
        <div class="container">
            <h1>Your Parcel's information</h1>
            <!-- <?php 
$parcel_weight = $user_parcel->getWeight();
?>
 -->
            <?php 
if ($valid_parcel == true) {
    echo "<p>Weight: " . $user_parcel->getWeight() . " </p>\n                            <p>Length: " . $user_parcel->getLength() . "</p>\n                            <p>Width: " . $user_parcel->getWidth() . " </p>\n                            <p>Height: " . $user_parcel->getHeight() . " </p>\n                            <p>Volume: " . $user_parcel->getVolume() . " </p>\n                            <p>Your cost to ship: \$" . $user_parcel->costToShip() . " </p>";
} else {
    echo "<h4>This is not a valid parcel!</h4>";
}
?>
        </div>
    </body>
</html>
コード例 #15
0
ファイル: parcel.php プロジェクト: umamiMike/080315
<!DOCTYPE html>
<html>

<head>
  <title></title>

</head>
<body>
  <ul>
<?php 
$theString = "<li> The Parcel Length is: ";
$theString .= $a->getLength();
$theString .= "</li>";
$theString .= "<li> The Parcel Width is: ";
$theString .= $a->getWidth();
$theString .= "</li>";
$theString .= "<li>The Parcel Height is: ";
$theString .= $a->getHeight();
$theString .= "</li>";
$theString .= "<li> The Parcel Weight is: ";
$theString .= $a->getWeight();
$theString .= "</li>";
$theString .= "<li> The Parcel Volume is: ";
$theString .= $a->volume();
$theString .= "</li>";
$theString .= "<li> The Cost to Ship is: ";
$theString .= $a->costToShip();
$theString .= "</li>";
echo $theString;
?>