9.0 KiB
Digest
1. Description
In this project, you are required to complete the following parts: Part 1: Pseudo code of the first function "Converting Euro or USD to HKD" Part 2: The coding in Python acceptable style of all 3 functions of Investment Banking System (IBS):
- Converting Euro or USD to HKD
- Calculating the minimum number of coins
- Calculating the total amount of principle and compound interest
Coding of system menu is provided to you in this file. You need to copy the code to the source file / online simulator:
Copy and paste your work into the provided MS word file EA Project*Answer Sheet*<<Your Name>>.docx
(e.g. EA Project_Answer Sheet_ChanTaiMan.docx
) and upload to Moodle.
2. Background
VTC Bank it is a local investment bank in Hong Kong. In order to attract investments from foreign cities, VTC Bank is planning to develop a program to provide the following services:
- Providing a currency converter;
- Introducing the coins issued in Hong Kong; and
- Providing compound interest calculator.
Assuming you are the programmer of VTC Bank, your manager asks you to develop the program.
3. IBS Structure
There are 3 functions of IBS:
- Converting Euro and US dollars to Hong Kong Dollar;
- Calculating the minimum number of coins for corresponding amounts of dollars;
- Calculating the total amount of principle and compound interest
3.1. Show menu
At the beginning, the program should show a menu. The user input a number to use a particular function. The following table shows the number and function mapping:
Number | Function |
---|---|
1 | Converting Euro or USD to HKD |
2 | Calculating the minimum number of coins |
3 | Calculating the total amount of principle and compound interest |
4 | Quit the system |
Assume the user will input valid number (i.e. 1, 2, 3 or 4), this part is already done for you.
3.2. Go back to menu or continue
After every function is finished (except quit the system), the program should show the menu again and ask user to choose a function.
*This part is already done for you.
4. IBS Functions
4.1. Converting Euro or USD to HKD
When user chooses this function, user can convert Euro or USD to HKD. User inputs strings "Euro" or "USD" to choose to convert Euro to HKD or USD to HKD respectively. Then, the program asks the user to input the amount of Euro or USD. After the users input the amount, the program shows the amount of HKD.
*Assume the user will input valid strings (i.e. "Euro" and "USD")
4.2. Calculating the minimum number of coins
When user chooses this function, the program calculates the minimum number of coins for corresponding amounts of dollars. User inputs an amount, then the program shows the minimum number of 10-dollar coins, 5-dollar coins, 2-dollar coins and 1-dollar coins.
4.3. Calculating the total amount of principle and compound interest
When user chooses this function, the program calculates the compound interest based on the inputted principle, interest rate and number of years compounded. User inputs principle, interest rate and number of years compounded, the program shows the total amount of principle and compound interest.
You have to use while loop to finish this function. Otherwise, marks will be deducted.
5. Sample input and output
All user inputs are bolded and underlined.
1. When program starts, the program shows the menu (this part is already done for you)
Welcome to IBS! Please choose one of the following functions
1. Converting Euro or USD to HKD
2. Calculating the minimum number of coins
3. Calculating the total amount of principle and compound interest
4. Quit
2. Convert Euro or USD to HKD
Welcome to IBS! Please choose one of the following functions
1. Converting Euro or USD to HKD
2. Calculating the minimum number of coins
3. Calculating the total amount of principle and compound interest
4. Quit
1
Currency to be converted to HKD (Euro / USD): Euro
Amount to be converted: 10000
10000.0 Euro = 80200.0 HKD
3. Calculate the minimum number of coins
Welcome to IBS! Please choose one of the following functions
1. Converting Euro or USD to HKD
2. Calculating the minimum number of coins
3. Calculating the total amount of principle and compound interest
4. Quit
2
Input an amount: 28
The minimum numbers of coins for 21 dollars are:
10-dollar coin(s): 2
5-dollar coin(s): 1
2-dollar coin(s): 1
1-dollar coin(s): 1
HINTS:
- Use the division (/) and remainder (%) operators.
- The inputted amount should be an integer.
4. Calculating the total amount of principle and compound interest
Welcome to IBS! Please choose one of the following functions
1. Converting Euro or USD to HKD
2. Calculating the minimum number of coins
3. Calculating the total amount of principle and compound interest
4. Quit
3
Input principle: 10000
Input interest rate: 0.05
Input number of years compounded: 4
The total amount of principle and compound interest: 12155.0625
HINTS:
- The inputted number of years should be integer.
- Use while loop to finish this function.
5. Quit the system (this part is already done for you)
Welcome to IBS! Please choose one of the following functions
1. Converting Euro or USD to HKD
2. Calculating the minimum number of coins
3. Calculating the total amount of principle and compound interest
4. Quit
4
Thanks for using IBS! Bye!
6. Hints
- Use input() to get user input, for example:
name = input("Enter your name:");
# variable "name" will store the string inputted by user
- Use int() & input() to get user input and convert the datatype from string to integer, for example:
amount = int(input("Enter an integer value:"));
# variable "amount" will store the integer inputted by user
- Use float() & input() to get user input and convert the datatype from string to floating-point number, for example:
amount = float(input("Enter an floating-point value:"));
# variable "amount" will store the floating-point number inputted by user
7. Assumption
- All user inputs are valid.
- You should copy the following code to the source file / online simulator to start your work. You are required to add codes of functions 1, 2 and 3 into the program.
"""
ITE3919 - Programming Essentials in Python (Mini Project)
Student Name: <<Your Name>>
Student No: <<Your Student No.>>
"""
EURO_RATE = 8.02
USD_RATE = 7.75
while True:
print("Welcome to IBS! Please choose one of the following functions")
print("1. Converting Euro or USD to HKD")
print("2. Calculating the minimum number of coins")
print("3. Calculating the total amount of principle and compound interest")
print("4. Quit")
command = input()
if command == "1":
# add your code of Function 1 here
elif command == "2":
# add your code of Function 2 here
elif command == "3":
# add your code of Function 3 here
elif command == "4":
print("Thanks for using IBS! Bye!")
break
8. Marking Criteria
Criteria | Proportion |
---|---|
Pseudo Code of Function 1 | 10% |
Function 1: Converting Euro or USD to HKD | 10% |
Function 2: Calculating the minimum number of coins | 10% |
Function 3: Calculating the total amount of principle and compound interest | 5% |
Program Style and Design | 5% |
9. Deadline
The deadline of this assignment is DD/MMM/YYYY (WWW) HH:MM
(GMT+8) according to Hong Kong Observatory Time.
10. Submission Guideline
"""
ITE3919 - Programming Essentials in Python (Mini Project)
Student Name:<<Your Name>>
Student No:<<Your Student No>>
"""
✔️ Add the following information as comment at the beginning of your source code:
✔️ Copy your source code from source file / online simulator to provided word file EA Project*Answer Sheet*<<Your Name>>.docx
(e.g. EA Project_Answer Sheet_ChanTaiMan.docx
)
✔️ Submit the word file to Moodle
✔️ For students who doesn’t follow the file name format, marks will be deducted
11. Remarks
✔️ This assignment worth 40% of the total course masrk
✔️ This is an individual assignment. No collaboration work is allowed
✔️ Plagiarism will be SERIOUSLY PUNISHED. All the plagiarism assignment will receive 0 marks
✔️ Enjoy your work