題意:
使用python撰寫一個賬單管理系統
決議:
用Python撰寫應用程式,該程式能夠記錄用戶的收入和支出,能夠顯示余額的變化,用戶能夠指定時間設定收入與支出。
程式需要從檔案中讀取資訊當作起始條件,隨后根據指令進行操作:
trancaction:當用戶輸入該指令后,提示用戶輸入交易涉及多少錢,正數為收入,負數為支出,然后反應在余額中。
next:進入第二天。但如果用戶余額低于0,則列印“你欠債了”,程式結束;否則,程式應該列印到第二天,開始新的一天。
status:顯示到目前的情況匯總,而且回根據當前金額與起始金額與用戶互動。
regular:用戶能夠指定一些常規的收入或者指出資訊。
help:顯示提示資訊,提示用戶指令的操作
quit:退出程式。
這是一個字串處理的問題,當用戶輸出的字串和指令相匹配則執行相應的操作,如果不是上述的所有指令則列印提示資訊。
涉及知識點:
檔案讀寫、字串處理、陣列
pdf原文
INFO1110 / COMP9001 Assignment 1
Money Tracker
Deadline: 23rd Sept 2019, 11:59pm AEST (Week 8, Monday)
Weighting: 10% of the final assessment mark
Overview
Brief Description
You will write a program that allows the user to manage their finances. The program will be able
to record the user’s incomes and expenses, display how their balance has changed, etc. It will also
need to be able to handle regular incomes and expenses; for example, the user will be able to
specify that they have a $100 income every Sunday, or that they spend $40.50 every Thursday.
Implementation details
Your program will be written in Python 3. The only modules you may import are sys and the
function.py file which you will write yourself.
Submission
You will submit your code on the assignment page on Ed. To make a submission, you will need to
press the “Mark” button. You may submit as many times as you wish without penalty - we will
mark the last submission that you make. After each submission, the marking system will
automatically check your code against the public test cases.
Please ensure you carefully follow the assignment specification. Your program output must
exactly match the output shown in the examples.
Warning: Any attempts to deceive or disrupt the marking system will result in an immediate zero
for the entire assignment. Negative marks can be assigned if you do not properly follow the
assignment specifications, or your code is unnecessarily or deliberately obfuscated.
Help and feedback
You are encouraged to ask questions about the assignment during the Helpdesk and on the Ed
discussion board; however, remember that you should not be posting any assignment code
publicly, as this would constitute academic dishonesty.
The Program
Starting the Program
The program will be given 1 extra command line argument when it is run:
$ python3 tracker.py (filename)
This (filename)will specify a file with information about regular incomes and expenses; see the
section on Regular Transactions for more information (it is recommended that you implement
this feature last).
After handling this file, the program will ask the user for their starting balance, like so:
Starting balance: $
The user will then fill out this field with their initial balance, for example:
Starting balance: $4.11
—If the starting value cannot be converted to a float, the program should print Error:
Cannot convert to float! and quit immediately
Starting balance: $cat
Error: Cannot convert to float!
—If the starting value is negative or zero, the program should print Error: Must start with
positive balance! and quit immediately.
Starting balance: $-5
Error: Must start with positive balance!
Once we have the regular payments and initial balance set up, we’re good to go! The program
should now continually ask for input, like so:
Enter command:
Depending on what the user enters, the program will record new transactions, show some
statistics, etc. For example, if the user types transaction …
Enter command: transaction
…then the transaction operation (explained below) should execute. The program should
continue asking for more inputs indefinitely, and execute the appropriate code each time.
Operations
uj5u.com熱心網友回復:
這是來踢館的嗎?
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/23413.html
標籤:多媒體
上一篇:modbus poll的二次開發
下一篇:VB模糊洗掉sheet
