Jump to content

Recommended Posts

Right... I see the people above decided to be really helpful...

 

Say somebody wanted to sell you a lightly worn, 8 GB, black 1st gen iPhone with charger, USB cable, and a headset. How would you figure out what you wanted to pay for that? If you don't know that then you won't know how to teach a computer to figure it out either.

 

Here is how I would do it:

Have a base price for each model. Each of the other things you can select between will modify the price. E.g. a broken item could decrease the price by 60% where light wear would only decrease it by 15%. Whether it's black or white doesn't affect the price, so it won't alter it. This is essentially the decorator pattern.

 

Also, I'll move this to app design.

Hi,

I have my values as follwoing:

Each iPod on a different size has a base price.

For example a Nano 8gb and a Nano 4gb Have a different price.

Then the colour does not effect the price of the iPod.

The standard trade in condition is NW which is the base price

EX condition has a +10% value and HW has a -10% value.

I understand all my values, i just need to know how to make a form that enables me to show the values that change.

 

I have placed the values of all the iPods in an excel spreadsheet and with the values of the added items such as headphones etc.

 

Thank you for your help.

 

Sam

Right... I see the people above decided to be really helpful...

 

Say somebody wanted to sell you a lightly worn, 8 GB, black 1st gen iPhone with charger, USB cable, and a headset. How would you figure out what you wanted to pay for that? If you don't know that then you won't know how to teach a computer to figure it out either.

 

Here is how I would do it:

Have a base price for each model. Each of the other things you can select between will modify the price. E.g. a broken item could decrease the price by 60% where light wear would only decrease it by 15%. Whether it's black or white doesn't affect the price, so it won't alter it. This is essentially the decorator pattern.

 

Also, I'll move this to app design.

 

 

Awkward.....

 

I thought it was just a normal calculator.  Didn't realize it was a pricing calculator.  I didn't bother looking at the site when I saw no code posted.

You could use the decorator pattern like I said above, or you can do something like this:

 

<?php
$basePrice = 100; // determine this based on the type of model

if ($_POST['condition'] == 'NW') {
$basePrice *= 1.1; // add 10%
}

// etc.

echo $basePrice;
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.