python发票打印程序_用python打印正确的票据生成程序

对于用python编程相对比较陌生,感谢您对我在另一个python项目上的上一个问题提供的所有快速帮助。无论如何,我用python为一个项目编写了一个新程序,该程序生成了一个餐饮场所的账单。这是我下面的代码,一切运行良好,我得到了项目所需的预期结果,我所经历的两个问题是,1。我需要沙漠的成本,而不是打印3.0美元,而是3.00美元,基本上,我如何打印美元符号,圆形e.x 3.0--3.00,或45.0--45.00…并在价格前加美元符号。如果有人问过这样的问题,我很抱歉。。在import math

# constants

Cost_Per_Desert = 3.00

Tax_Rate = .075

Gratuity_Tips = .15

Adult_Meal_Cost = 12.75

Child_Meal_Cost = .60*12.75

Room_Fee = 450.00

Less_Deposit = 250.00

def main():

# Input Section

Name = input("\n\n Customer:\t\t\t ")

Number_Of_Adults = int(input(" Number of Adults:\t\t "))

Number_Of_Children = int(input(" Number of Children:\t\t "))

Number_Of_Deserts = int(input(" Number of Deserts:\t\t "))

print("\n\nCost Of Meal Per Adult:\t\t" , Adult_Meal_Cost)

print("Cost of Meal Per Child:\t\t" , round(Child_Meal_Cost,2))

print("Cost Per Desert:\t\t" , round(Cost_Per_Desert,2))

# Processing/Calculations

Total_Adult_Meal_Cost = Adult_Meal_Cost* Number_Of_Adults

Total_Child_Meal_Cost = Child_Meal_Cost* Number_Of_Children

Total_Desert_Cost = Cost_Per_Desert* Number_Of_Deserts

Total_Food_Cost = Total_Adult_Meal_Cost + Total_Child_Meal_Cost + Total_Desert_Cost

Total_Taxes = Total_Food_Cost * Tax_Rate

Tips = Total_Food_Cost * Gratuity_Tips

Total_Bill = Total_Food_Cost + Total_Taxes + Tips + Room_Fee

# Output Section

print("\n\n Total Cost for Adult Meals: \t", Total_Adult_Meal_Cost)

print(" Total Cost for Childs Meals: \t", Total_Child_Meal_Cost)

print(" Total Cost for Desert: \t", Total_Desert_Cost)

print(" Total Food Cost: \t\t", Total_Food_Cost)

print("\n\n Plus 7.5% Taxes: \t\t", round(Total_Taxes,2))

print(" Plus 15.0% Tips: \t\t", round(Tips,2))

print(" Plus Room Fee: \t\t", Room_Fee)

print("\n\n Total Bill: \t\t\t", round(Total_Bill,2))

print(" Less Deposit: \t\t\t", Less_Deposit)

print("\n\nBalance Due: \t\t\t", round(Total_Bill - Less_Deposit,2))

print("\n\n\n\n\t\t Thank You For Using Passaic County Catering Services. ")

main()

input("\n\n\n\n\nPress Enter to Continue")

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值