Describe the necessary user inputs from the program using the following table format. Choose the appropriate data type to store each user input and explain your choice.
Input | data type chosen and why |
Note that you are expected to take into consideration the value(s)
of each transaction category. For example, your program should
assess the transaction amount of each bill paid by the user before
classifying it under the bill payment category.
Below is the python program:
from math import *
#INPUT
#in case they put invalid input
while True:
try:
bonus_saver_daily_balance = float(input("Please enter your
estimated average daily balance: S$"))
break;
except ValueError:
print("Invalid input. Please key in numeric value")
continue
print("1. Less than S$500")
print("2. $500 to $1999")
print("3. $2000 or more")
while True:
try:
selection = int(input("Please enter option: "))
break;
except ValueError:
selection >= 3
print("Invalid option enter. Please enter 1, 2 or 3")
continue
while True:
try:
salary_credit = input("Do you credit a minimum of S$3000 net
monthly income to the account(Yes or No): ")
if salary_credit.lower() == "yes" or salary_credit.lower() ==
"no":
break;
else:
print("Invalid input. Please key in Yes or No.")
except:
continue
while True:
try:
investment = input("Do you invest on eligible unit trust with a
minimum subscription sum of S$30000 from the bank(Yes or
No):")
if investment.lower() == "yes" or investment.lower() == "no":
break;
else:
print("Invalid input. Please key in Yes or No.")
except:
continue
while True:
try:
insurance = input("Do you purchase a minimum S$12000 Prudential
life insurance premium from the bank (Yes or No)")
if insurance.lower() == "yes" or insurance.lower() == "no":
break;
else:
print("Invalid input. Please key in Yes or No.")
except:
continue
while True:
try:
billing_method = input("Do you use your GIRO or online banking
platform to make at least 3 bill payment with at least S$50 each?
(Yes or No)")
if billing_method.lower() == "yes" or billing_method.lower() ==
"no":
break;
else:
print("Invalid input. Please key in Yes or No.")
except:
continue
#PROCESS
#If monthly spend S$2000 or more, earn 0.80% annual interest.
#elif spend less than S$2000 but more than or equal to $500 to earn
0.30%
#else less than S$500 = 0% per annum
print("\n ")
print("Below are your results from your input:\n ")
print("Estimated daily balance S${:.2f}".format(bonus_saver_daily_balance))
if selection >= 1 and selection <=3:
if selection == 1:
interest_spending = 0
print("Interest earn: 0.00%. (You did not meet minimum spending
requirement)")
elif selection == 2:
interest_spending = 0.3
print("Bonus interest earn from spending: 0.30% p.a.")
else:
interest_spending = 0.8
print("Bonus interest earn from spending: 0.80% p.a.")
else:
print("You have enter an INVALID OPTION in spending category which
causes an ERROR. Please try again.")
#If credit a minimum of S$3,000 net monthly income into account to
earn additional 0.40% p.a. bonus interest
if salary_credit.lower() == 'yes':
interest_salary = 0.4
print("Additional bonus interest earn from crediting net monthly
income: 0.40% p.a.")
else:
interest_salary = 0
print("Interest earn: 0.00%. (You did not meet minimum monthly net
income credit requirement)")
#Invest through the bank on Eligible Unit Trust with a minimum subscription sum of $30000 to earn additional 0.85% p.a. bonus interest
if investment.lower() == 'yes':
interest_investment = 0.85
print("Additional bonus interest earn from subscription of Eligible
Unit Trust: 0.85% p.a.")
else:
interest_investment = 0
print("Interest earn: 0.00%. (You did not meet minimum subscription
sum on Eligible Unit Trust)")
#Purchase of Eligible Insurance Policy distributed by the bank and underwritten from Prudenital with a minimum annual premium of $12000 to earn additional 0.85% p.a. bonus interest
if insurance.lower() == 'yes':
interest_insurance = 0.85
print("Additional bonus interest earn from purchasing of insurance:
0.85% p.a.")
else:
interest_insurance = 0
print("Interest earn: 0.00%. (You did not meet the eligible
requirement)")
#Earn 0.10% p.a. bonus interest when you make 3 bill payment with
at least $50 each using GIRO or Online banking platform
if billing_method.lower() == 'yes':
interest_billing = 0.10
print("Additional bonus interest earn from bill payment using GIRO
or online banking platform: 0.10% p.a.")
else:
interest_billing = 0
print("Interest earn: 0.00%. (You did not meet the requirement by
making at least 3 bill payment with at least S$50 each)")
total_interest = interest_spending + interest_salary +
interest_investment + interest_insurance + interest_billing
amount_earn_annual = (total_interest/100) *
bonus_saver_daily_balance
print("Amount earn from total interest per annum is S${:.2f} @
{:.2f}%.".format(amount_earn_annual,total_interest))
monthly_interest = total_interest/12
amount_earn_monthly = (monthly_interest/100) *
bonus_saver_daily_balance
print("Amount earn from total interest per month is S${:.2f} @
{:.2f}%.".format(amount_earn_monthly,monthly_interest))
1)first it prompts for the user to enter sestimated average daily balance in $.and it can be in decimal points so the data type for stroing it is float
2)if the user enter a number it takes and continues to next step (4)
3)otherwise it prints invalid input and goes to step 1
4)it prompts the user to enter option 1)if it is below $500 2) if it is in between $500 and $2000 3) if it is above $2000
5)if user enters an option of 1 2 or 3 it proceeds and the data type required is int as it is integer
6)otherwise it prompts user to enter a valid option and got to step (4)
7)it prompts the user for Do you credit a minimum of S$3000 net monthly income to the account(Yes or No): "
8) the data type required to store it is string as it is string.and if user may enter yes or no in either uppercase or lower case
9) if the user enters other option it display invalid option and got step (8)
10)it prompts the user for Do you credit a minimum of S$3000 net monthly income to the account(Yes or No): "
11)the data type required to store it is string as it is string.and if user may enter yes or no in either uppercase or lower case
12)if the user enters other option it display invalid option and got step (10)
13)it prompts the user for Do you purchase a minimum S$12000 Prudential life insurance premium from the bank (Yes or No)
14)the data type required to store it is string as it is string.and if user may enter yes or no in either uppercase or lower case
15)f the user enters other option it display invalid option and got step (13)
16)it prompts the user for Do you use your GIRO or online banking platform to make at least 3 bill payment with at least S$50 each? (Yes or No)
17)the data type required to store it is string as it is string.and if user may enter yes or no in either uppercase or lower case
18)f the user enters other option it display invalid option and got step (16)
PROCESS for caliculating ur intrest based on ur inputs
If monthly spend S$2000 or more, earn 0.80% annual interest.
elif spend less than S$2000 but more than or equal to $500 to earn
0.30%
else less than S$500 = 0% per annum
19) it displays ur average dailay spending and if it is below $500 it says u did not meet ur requiremnt i.e u are not eligible for it
20)if it is between $500 and $2000 u can earn an anual intrest of 0.30%
21) if it is above $2000 u can earn an anual intrest of 0.80%
22)if salary_credit.lower() == 'yes': ur interest_salary = 0.4 it is float otherwise u are not eligible
23)if insurance.lower() == 'yes': interest_insurance = 0.85 it is float otherwise ur not eligible
24)if investment.lower() == 'yes': interest_investment = 0.85 it is float otherwise ur not eligibel
#Earn 0.10% p.a. bonus interest when you make 3 bill payment with at least $50 each using GIRO or Online banking platform
25)if billing_method.lower() == 'yes': interest_billing = 0.10 andit prints Additional bonus interest earn from bill payment using GIRO or online banking platform: 0.10% p.a.
26)else interest_billing = 0 it prins interest earn: 0.00%. (You did not meet the requirement by making at least 3 bill payment with at least S$50 each
27) total intrest is caluculated as below
total_interest = interest_spending + interest_salary + interest_investment + interest_insurance + interest_billing
28)amount_earn_annual = (total_interest/100) * bonus_saver_daily_balance
29)monthly_interest = total_interest/12
30)amount_earn_monthly = (monthly_interest/100) * bonus_saver_daily_balance
31) it prints thsoe values upto 2decimal values
Thank you upvote if u like
Describe the necessary user inputs from the program using the following table format. Choose the appropriate...
Using python 3.6 How do I incorporate 0 or negative input to raise an error and let the user try again? like <=0 #loop to check valid input option. while True: try: choice = int(input('Enter choice: ')) if choice>len(header): print("Invalid choice!! Please try again and select value either:",end=" ") for i in range(1,len(header)+1): print(i,end=",") else: break choice = int(input('\nEnter choice: ')) except ValueError as ve:print('Invalid response, You need to select the number choice from the option menu') # Catch your...
My program crashes on the line (print('\nThe maximum value from the file is {}'.format(max(i)))) with the error message TypeError: "int" object not iterable. The purpose of this program is to create an process binary files. Can you tell me what's going wrong? Thanks! ( *'s indicate indentation) from sys import argv from pickle import dump from random import randint from pickle import load if (argv[1] == 'c'): ****output_file = open(argv[2], 'wb') ****for i in range(int(argv[3])): ********dump(randint(int(argv[4]), int(argv[5])), output_file) ****output_file.close() ****print('{}...
JAVA: amortization table: Hi, I have built this code and in one of my methods: printDetailsToConsole I would like it to print the first 3 payments and the last 3 payments if n is larger than 6 payments. Please help! Thank you!! //start of program import java.util.Scanner; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.lang.Math; //345678901234567890123456789012345678901234567890123456789012345678901234567890 /** * Write a description of class MortgageCalculator here. * * @author () * @version () */ public class LoanAmortization { /* *...
(1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt) Ex: Enter a sample text: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue! You entered: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews...
/*************************************************** Name: Date: Homework #7 Program name: HexUtilitySOLUTION Program description: Accepts hexadecimal numbers as input. Valid input examples: F00D, 000a, 1010, FFFF, Goodbye, BYE Enter BYE (case insensitive) to exit the program. ****************************************************/ import java.util.Scanner; public class HexUtilitySOLUTION { public static void main(String[] args) { // Maximum length of input string final byte INPUT_LENGTH = 4; String userInput = ""; // Initialize to null string Scanner input = new Scanner(System.in); // Process the inputs until BYE is entered do {...
Use program control statements in the following exercises: Question 1 . Write pseudocode for the following: • Input a time in seconds. • Convert this time to hours, minutes, and seconds and print the result as shown in the following example: 2 300 seconds converts to 0 hours, 38 minutes, 20 seconds. Question 2. The voting for a company chairperson is recorded by entering the numbers 1 to 5 at the keyboard, depending on which of the five candidates secured...
In the program, the zipcode will be represented by an integer and the corresponding barcode will be represented by a string of digits. The digit 1 will represent the long bar, and the digit 0 will represent the short bar, The first and last digits of a POSTNET code are always 1. Stripping these leaves 25 digits, which can be split into groups of 5. The above example translates into the following string and groups of five: 101100100010010101100110001 01100 10001...
C LANGUAGE. PLEASE INCLUDE COMMENTS :) >>>>TheCafe V2.c<<<< #include <stdio.h> int main() { int fries; // A flag denoting whether they want fries or not. char bacon; // A character for storing their bacon preference. double cost = 0.0; // The total cost of their meal, initialized to start at 0.0 int choice; // A variable new to version 2, choice is an int that will store the // user's menu choice. It will also serve as our loop control...
Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...
For this assignment, you will write a program to work with Huffman encoding. Huffman code is an optimal prefix code, which means no code is the prefix of another code. Most of the code is included. You will need to extend the code to complete three additional methods. In particular, code to actually build the Huffman tree is provided. It uses a data file containing the frequency of occurrence of characters. You will write the following three methods in the...