<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Software Sales (Python)' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Software Sales (Python)' posted on the 'Python' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 17:09:02 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 17:09:02 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Software Sales (Python)</title>
      <link>http://www.programmersheaven.com/mb/python/427490/427490/software-sales-python/</link>
      <description>A software company sells a package that retails for $99. Quantity discounts are given&lt;br /&gt;
according to the following table:&lt;br /&gt;
Quantity Discount&lt;br /&gt;
10–19 20%&lt;br /&gt;
20–49 30%&lt;br /&gt;
50–99 40%&lt;br /&gt;
100 or more 50%&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;This is what I have done. Please correct me because I cannot run Python&lt;/strong&gt;.&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
# Named constants&lt;br /&gt;
RETAIL_PRICE = 99&lt;br /&gt;
&lt;br /&gt;
# main function&lt;br /&gt;
def main():&lt;br /&gt;
    # Local variables&lt;br /&gt;
    quantity = 0&lt;br /&gt;
    fullPrice = 0.0&lt;br /&gt;
    discountRate = 0.0&lt;br /&gt;
    discountAmount = 0.0&lt;br /&gt;
    totalAmount = 0.0&lt;br /&gt;
&lt;br /&gt;
    # Get number&lt;br /&gt;
    quantity = int(input("Enter the number of packages purchased: "))&lt;br /&gt;
&lt;br /&gt;
    # Calculate the discount rate&lt;br /&gt;
    if quantity &amp;gt; 99:&lt;br /&gt;
	discountRate = 50/100&lt;br /&gt;
    elif quantity &amp;gt; 49:&lt;br /&gt;
	discountRate = 40/100&lt;br /&gt;
    elif quantity &amp;gt; 19:&lt;br /&gt;
	discountRate = 30/100&lt;br /&gt;
    elif quantity &amp;gt; 9:&lt;br /&gt;
	discountRate = 20/100&lt;br /&gt;
    else:&lt;br /&gt;
	discountRate = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    # Calculate the full price&lt;br /&gt;
    fullPrice = quantity * RETAIL_PRICE&lt;br /&gt;
&lt;br /&gt;
    # Calculate the discount amount&lt;br /&gt;
    discountAmount = fullPrice * discount&lt;br /&gt;
&lt;br /&gt;
    #Calculate the total amount&lt;br /&gt;
    totalAmount = fullPrice - discountAmount&lt;br /&gt;
&lt;br /&gt;
    # print results&lt;br /&gt;
    showPurchase(discountAmount, totalAmount)&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
# The showPurchase function accepts discountAmount, totalAmount as &lt;br /&gt;
# arguments and displays the amounts &lt;br /&gt;
def showPurchase(discountAmount, totalAmount):&lt;br /&gt;
    print ("Discount Amount: $", format(discountAmount, '.2f'))&lt;br /&gt;
    print ("Total Amount: $", format(totalAmount, '.2f'))&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/python/427490/427490/software-sales-python/</guid>
      <pubDate>Sat, 18 Feb 2012 19:31:36 -0700</pubDate>
      <category>Python</category>
    </item>
  </channel>
</rss>