2017-07-30 15 views
-3

こんにちは私はエラーを与え続けるPythonコードを持っています。これは私のpythonクラスの携帯電話の請求額を計算するためです。私はこれを持っていますが、値は返されません。クラスのPythonコード戻り値がありません

経済プランには、30ドルの無制限の音声とテキスト、1GBのデータが10ドル、6ドルのすべてのGBが含まれます。

通常のプランには、30ドルの無制限の音声とテキスト、5GBのデータ、30ドルの5GBのデータ、1GB以上のすべてのデータが含まれます。

class cellphone: 
    cost = 30 
    due = 0 
    amountGB = 0 
    Total = 0 

    def econPlan (self, gB, gbOver): 
     self.cost = 30 
     self.gB = 1 
     self.gbOver = 6 
     self.due = 0 

     while amountGB >= self.gB: 
      int(amountGB - self.gB)* self.gbOver 
     return self.due 

     while cPlan == Econ and amountGB >= self.gB: 
      print ("$",self.due) 

    def normPlan (self, gB, gbOver): 
     self.cost = 30 
     self.gB = 5 
     self.gbOver = 4 

     while amountGB >= self.gB: 
      int(amountGB - self.gB)* self.gbOver 
     return self.due 

     while cPlan == Norm and amountGB >= self.gB: 
      print ("$",self.due) 






print (" Which Plan do you have: econ or norm?") 
print (" Econ is $30 unlimited voice and text, 1 GB data for $10, and $6 for every GB over.") 
print (" Norm is $30 unlimited voice and text, 5 GB data for $30, and $4 for every GB over.") 

econ = cellphone.econPlan 
norm = cellphone.normPlan 
cellphone.cPlan = input ("So which plan do you have? >>") 
if cellphone.cPlan == econ: 
    print ("you have the Economy plan") 

elif cellphone.cPlan == norm: 
    print ("you have the Normal plan") 

cellphone.amountGB = input ("how many GB did you used >>") 
if cellphone.cPlan == "Econ": 
    print (cellphone.due) 
+2

エラーを投稿... –

+2

エラーは何ですか? –

+0

「自己」はどこですか? –

答えて

0

自己内にのみ存在します。メソッド内の変数の現在の値を取得する場合は、メソッドを呼び出して変数を返します。

関連する問題