mercredi 20 février 2019

if statements with classes in Python

I am making a small command prompt menu program. The User selects a letter option and the code take them to a small set of code that that makes specific calculations for them.

I have gotten the menu to work. However when i run C for Distributors nothing prints. What should I change?

def main():

variable_to_cause_loop = "Y"

while  variable_to_cause_loop == "Y":

    print ('A: Accounting')
    print ('B: Quick Estimate')
    print ('C: Distributors')

    User_Menu_Selection = input('Enter an option: ')

    if User_Menu_Selection == "A":
        print("Feature not available")


    elif User_Menu_Selection == "B":


        class Shoes:
            print('COMPANY MESSAGE', '\n' *5)
            print('--> Quick Estimates <--')

            def __init__(self, Model, Descpstr, price):
                self.Model = Model
                self.Descpstr = Descpstr
                self.price = int(price)



        A100 = Shoes("A100", "Prada Flat Black", 100)
        A200= Shoes("A300", "Gucci Heel Black", 275)



        product_num = input('> Shoe Model(model number): ')
        product_size = input('> Shoe Size: ')
        product_qty = input('> Quantitiy: ')
        ship_zip_code = input('> Ship to Zip Code: ')




        if product_num == "A100" or product_num == "a100":
            order_calc = float(A100.price) * float(product_qty)
            print (float(order_calc))

        elif product_num == "A200" or product_num == "a200":
            order_calc = float(A200.price) * float(product_qty)
            print (float(order_calc))


        elif User_Menu_Selection == "C":
            print ("")
            print ("DISTRIBUTORS")
            print ("")
            print ("")
            print ("> Elderado's   Rep: Jack Reed   - Phone  # 1-888-562-2229 <")
            print ("> Friendly's   Rep: Roy Jack Jones   - Phone # 1-212-393-9939 <")
            print ("> Best Shoes Fort Wayne  Rep: Price Gouger   - Phone # 1-331-3832 <")
            print ("> The Rubber Maker   Rep: Crumble Crustipher   - Phone # 1-434-1919 <")




variable_to_cause_loop = input ("For Main Menu Type Y" )

main()

Aucun commentaire:

Enregistrer un commentaire