[Tutor] basic question

Woody 544 woody544 at gmail.com
Fri Apr 5 14:34:53 CEST 2013


On 4/5/13, Woody 544 <woody544 at gmail.com> wrote:
> Dear Najam
>
> The tax and license amounts should not need to be entered, as I would
> think the only variable is the base price, with tax and license
> calculated as their rate times the base price. For example, if the
> sales tax rate for the area is 6% for example:
>
> tax = price * 0.06
>
> Since the other fees are fixed, there is no need for raw input from
> the user on those either and the rates can be hard coded in.  If the
> tax rate = 6% and the license rate = 1% then:
>
> total = price + (price*.06) + (price * .01) + dealer_prep + des_charge
>
> Thus the only input from the user would be to enter the base price.
> Of course, if the intent is for more than just one dealership with
> varied rates and fees, it may make sense for the other values to be
> entered by a user.
>
> MJ
>
> On 4/5/13, Najam Us Saqib <ausnajm at yahoo.com.au> wrote:
>> Hi,
>>
>> My name is Najam, I am very new to Python Programming. Would you please
>> help
>> me with the following question?
>>
>> The question/problem is,
>>
>> Write a Car salesman program where the user enters the base price of a
>> car.
>> The program should add a bunch of extra fees such as tax, license, dealer
>> prep, and destination charge.Make tax and license a percent of the base
>> price. The other fees should be set values. Display the actual price of
>> the
>> car once all the extras are applied.
>>
>> I am not sure whether I have entered the right code for "Make tax and
>> license a percent of the base price." or not.
>>
>> My program is;
>>
>> price = float(raw_input("Enter the base price of the car $ "))
>>
>> tax = float(raw_input("Enter the tax $ "))
>> licence = float(raw_input("Enter the licence fees $ "))
>> dealer_prep = float(raw_input("Enter the dealer prep fees $ "))
>> des_charge = float(raw_input("Enter the destination charge $ "))
>>
>> percent = (tax * 0.01 + licence * 0.01) / price
>>       # ?????
>>
>> print "\nA percent of the base price is: $ " , percent
>>
>> total = price + tax + licence + dealer_prep + des_charge
>>
>> print "\nThe actual price of the car is: $ " , total
>>
>> raw_input("\nPress Enter key to Exit, thank you.")
>>
>>
>>
>> Thank you.
>> Najam.
>>
>


More information about the Tutor mailing list