Question

In: Computer Science

def main(): FISH_TACOS = 3.00 TACOS_AL_CARBON = 4.00 DON_PEDRO_SPECIAL = 9.00 PAPAS_CON_CHORIZO = 5.00 CARNE_ASADA_TACOS =...

def main():
    FISH_TACOS = 3.00
    TACOS_AL_CARBON = 4.00
    DON_PEDRO_SPECIAL = 9.00
    PAPAS_CON_CHORIZO = 5.00
    CARNE_ASADA_TACOS = 1.75
    SALES_TAX = 0.06
    DISCOUNT = 0.1
    costofFish_Tacos=.0
    costofTacos_Al_Carbon=.0
    costofDon_Pedro_Special=.0
    costofPapas_Con_Chorizo=.0
    costofCarne_Asada_Tacos=.0
    numofFish_Tacos=.0
    numofTacos_Al_Carbon=.0
    numofDon_Pedro_Special=.0
    numofPapas_Con_Chorizo=.0
    numofCarne_Asada_Tacos=.0
    subTotal=.0
    AmountGiven=.0
    cash = .0
    change = .0
    OrigTotal=.0
    WithTax=.0
    TotalOrder = .0
    AmountGiven = .0

    numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos= getInput()
    getOutput(FISH_TACOS,TACOS_AL_CARBON,DON_PEDRO_SPECIAL,PAPAS_CON_CHORIZO,CARNE_ASADA_TACOS,numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos)
    subTotal = calcOrder(FISH_TACOS,TACOS_AL_CARBON,DON_PEDRO_SPECIAL,PAPAS_CON_CHORIZO,CARNE_ASADA_TACOS,numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos)
    WithTax = CalcTax(subTotal,SALES_TAX)
    disTotal(subTotal, WithTax)
    CalcCash(OrigTotal, cash, change)

def getInput():
    numofFish_Tacos = int(input("How many Fish Tacos do you want?"))
    numofTacos_Al_Carbon = int(input("How many Tacos Al Carbon do you want?"))
    numofDon_Pedro_Special = int(input("How many Don Pedro Special do you want?"))
    numofPapas_Con_Chorizo = int(input("How many Paps Con Chorizo do you want?"))
    numofCarne_Asada_Tacos = int(input("How many Carne Asada Tacos do you want?"))
    return numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos

def getOutput(FISH_TACOS,TACOS_AL_CARBON,DON_PEDRO_SPECIAL,PAPAS_CON_CHORIZO,CARNE_ASADA_TACOS,numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos):
    costofFish_Tacos = FISH_TACOS * numofFish_Tacos
    costofTacos_Al_Carbon = TACOS_AL_CARBON * numofTacos_Al_Carbon
    costofDon_Pedro_Special = DON_PEDRO_SPECIAL * numofDon_Pedro_Special
    costofPapas_Con_Chorizo = PAPAS_CON_CHORIZO * numofPapas_Con_Chorizo
    costofCarne_Asada_Tacos = CARNE_ASADA_TACOS * numofCarne_Asada_Tacos
    print(numofFish_Tacos, "Fish Tacos", "each at $", FISH_TACOS, "Costs $", costofFish_Tacos)
    print(numofTacos_Al_Carbon, "Tacos Al Carbon", "each at $", TACOS_AL_CARBON, "Costs $", costofTacos_Al_Carbon)
    print(numofDon_Pedro_Special, "Don Pedro Special", "each at $", DON_PEDRO_SPECIAL, "Costs $",
          costofDon_Pedro_Special)
    print(numofPapas_Con_Chorizo, "Papas Con Chorizo", "each at $", PAPAS_CON_CHORIZO, "Costs $",
          costofPapas_Con_Chorizo)
    print(numofCarne_Asada_Tacos, "Carne Asada Tacos", "each at $", CARNE_ASADA_TACOS, "Costs $",
          costofCarne_Asada_Tacos)
    return FISH_TACOS,TACOS_AL_CARBON,DON_PEDRO_SPECIAL,PAPAS_CON_CHORIZO,CARNE_ASADA_TACOS,numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos

def calcOrder(FISH_TACOS,TACOS_AL_CARBON,DON_PEDRO_SPECIAL,PAPAS_CON_CHORIZO,CARNE_ASADA_TACOS,numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos):
    subTotal = ((numofFish_Tacos * FISH_TACOS) + (numofTacos_Al_Carbon * TACOS_AL_CARBON) + (numofDon_Pedro_Special * DON_PEDRO_SPECIAL) + (numofPapas_Con_Chorizo * PAPAS_CON_CHORIZO) + (numofCarne_Asada_Tacos * CARNE_ASADA_TACOS))
    print("Sub Total      $", subTotal)
    print('subTotal:', subTotal)
    return subTotal

def CalcTax(subTotal,SALES_TAX):
    WithTax = (SALES_TAX * subTotal)
    print("Total of the order with sales tax is:$ ", WithTax)
    print('With Tax:', WithTax)
    return WithTax

def disTotal(subTotal,WithTax):
    OrigTotal = WithTax + subTotal
    print('Total now is',OrigTotal)
    return OrigTotal

def CalcCash(OrigTotal, cash, change):
    OrigTotal = str(OrigTotal)
    cash = input('This is how much you owe'+OrigTotal+'Please pay in cash: ')
    OrigTotal = str(OrigTotal)
    print('Amount received: $', cash)

    OrigTotal = float(OrigTotal)
    cash =float(cash)

    change = cash - OrigTotal

    if change < 0:
        change=str(change)
        addChange = input('You still owe me $'+ change + 'Please pay in cash')
        change=float(change)
        addChange=float(addChange)
        change= addChange + change
    print('Costumer change is: $', change)
    print('------------------------------')

main()

Not calculating this part need help asap

def CalcCash(OrigTotal, cash, change):

OrigTotal = str(OrigTotal)

cash = input('This is how much you owe'+OrigTotal+'Please pay in cash: ')

OrigTotal = str(OrigTotal)

print('Amount received: $', cash)

OrigTotal = float(OrigTotal)

cash =float(cash)

change = cash - OrigTotal

if change < 0:

change=str(change)

addChange = input('You still owe me $'+ change + 'Please pay in cash')

change=float(change)

addChange=float(addChange)

change= addChange + change

print('Costumer change is: $', change)

print('------------------------------')

Solutions

Expert Solution

You are not using returned value from disTotal method. This is why the CalcCash method is getting the value of OrigTotal as 0.

Replace your main() method with this code: (for indentation please refer to screenshot)

def main():
    FISH_TACOS = 3.00
    TACOS_AL_CARBON = 4.00
    DON_PEDRO_SPECIAL = 9.00
    PAPAS_CON_CHORIZO = 5.00
    CARNE_ASADA_TACOS = 1.75
    SALES_TAX = 0.06
    DISCOUNT = 0.1
    costofFish_Tacos=.0
    costofTacos_Al_Carbon=.0
    costofDon_Pedro_Special=.0
    costofPapas_Con_Chorizo=.0
    costofCarne_Asada_Tacos=.0
    numofFish_Tacos=.0
    numofTacos_Al_Carbon=.0
    numofDon_Pedro_Special=.0
    numofPapas_Con_Chorizo=.0
    numofCarne_Asada_Tacos=.0
    subTotal=.0
    AmountGiven=.0
    cash = .0
    change = .0
    OrigTotal=.0
    WithTax=.0
    TotalOrder = .0
    AmountGiven = .0
    
    numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos= getInput()
    getOutput(FISH_TACOS,TACOS_AL_CARBON,DON_PEDRO_SPECIAL,PAPAS_CON_CHORIZO,CARNE_ASADA_TACOS,numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos)
    subTotal = calcOrder(FISH_TACOS,TACOS_AL_CARBON,DON_PEDRO_SPECIAL,PAPAS_CON_CHORIZO,CARNE_ASADA_TACOS,numofFish_Tacos,numofTacos_Al_Carbon,numofDon_Pedro_Special,numofPapas_Con_Chorizo,numofCarne_Asada_Tacos)
    WithTax = CalcTax(subTotal,SALES_TAX)
    OrigTotal = disTotal(subTotal, WithTax) # here storing OrigTotal returned from disTotal
    CalcCash(OrigTotal, cash, change)

Output:

Screenshot:

* Please see line 32, this is where I made changes.


Related Solutions

KFA expects to pay the following dividends over the next 4 years: $3.00, $4.00, $5.00, and...
KFA expects to pay the following dividends over the next 4 years: $3.00, $4.00, $5.00, and $6.00. After that, it expects to pay dividends that grow at 4%/year. If the required equity return is 15%, what should be today's share price?
Prob. Ret(A) Ret(B) 10% -5.00% -2.00% 20% 0.00% 1.00% 40% 5.00% 3.00% 20% 10.00% 4.00% 10%...
Prob. Ret(A) Ret(B) 10% -5.00% -2.00% 20% 0.00% 1.00% 40% 5.00% 3.00% 20% 10.00% 4.00% 10% 15.00% 5.00% 1) Please calculate covariance and correlation between A and B. 2) Please calculate the variance of a portfolio consisting of 45% of A and 55% of B. 3) Please find the MVP based on a portfolio consisting of A and B. What is the expected return of the MVP? What is the risk for the MVP? 4) Please find the optimal portfolio...
1.00 1.00 2.00 2.00 3.00 1.30 4.00 3.75 5.00 2.25 Make a scatterplot and include here...
1.00 1.00 2.00 2.00 3.00 1.30 4.00 3.75 5.00 2.25 Make a scatterplot and include here Calculate the regression line.
Blocks A (mass 5.00 kg ) and B (mass 9.00 kg ) move on a frictionless,...
Blocks A (mass 5.00 kg ) and B (mass 9.00 kg ) move on a frictionless, horizontal surface. Initially, block B is at rest and block A is moving toward it at 2.00 m/s . The blocks are equipped with ideal spring bumpers. The collision is head-on, so all motion before and after the collision is along a straight line. Let +x be the direction of the initial motion of block A. a.) Find the maximum energy stored In the...
4.00 moles of HI are placed in an evacuated 5.00 L flask and then heated to...
4.00 moles of HI are placed in an evacuated 5.00 L flask and then heated to 800 K. The system is allowed to reach equilibrium. What will be the equilibrium concentration of each species
A 10.0 mL aliquot of 0.1000 M base B (pKb1= 4.00, pKb2= 9.00) was titrated with...
A 10.0 mL aliquot of 0.1000 M base B (pKb1= 4.00, pKb2= 9.00) was titrated with 0.1000 M HCl. At what volume is the second equivalence point? Find the pH at the volume of the acid added (VHCl) equal 10.0 mL Find the pH at the volume of the acid added (VHCl) equal 20.0 mL. Please Explain!
. On a horizontal, frictionless surface, a 9.00 kg object initially moving east at 4.00 m/s...
. On a horizontal, frictionless surface, a 9.00 kg object initially moving east at 4.00 m/s collides with a 3.00 kg object that was initially moving north at 10.0 m/s. After the collision, the three-kilogram object moves with a velocity o 12.00 m/s directed 32.0o north of east. (a) Calculate the velocity of the nine-kilogram object after the collision, and (b) determine by calculation the type of collision that occurred.
The dibasic compound B (pKb1 5.00, pKb2 9.00) was titrated with 0.5 M HCl. The initial...
The dibasic compound B (pKb1 5.00, pKb2 9.00) was titrated with 0.5 M HCl. The initial solution of B was 0.0500 M and had a volume of 50.0 mL. Find the pH at the following volumes of acid added Va = 0, 1, 5, 9, 10, 11, 15, 19, 20, and 22 mL.
A -4.00 nC point charge is at the origin, and a second -5.00 nC point charge...
A -4.00 nC point charge is at the origin, and a second -5.00 nC point charge is on the x-axis at x = 0.800 mm. a. Find the net electric force that the two charges would exert on an electron placed at point on the x-axis at x = 0.200 mm. b. Find the net electric force that the two charges would exert on an electron placed at point on the x-axis at x = 1.20 mm. c. Find the...
A -3.00 nCnC point charge is at the origin, and a second -5.00 nCnC point charge...
A -3.00 nCnC point charge is at the origin, and a second -5.00 nCnC point charge is on the xx-axis at xx = 0.800 mm. Part A Find the electric field (magnitude and direction) at point on the xx-axis at xx = 0.200 mm. Express your answer with the appropriate units. Enter positive value if the field is in the positive xx-direction and negative value if the field is in the negative xx-direction. Ex = −800NC SubmitPrevious AnswersRequest Answer Incorrect;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT