Question: I have already written the code for this and made the label/text boxes and button. I need help getting my code to run. Can you
I have already written the code for this and made the label/text boxes and button. I need help getting my code to run. Can you please look at it and tell me what I'm doing wrong? Below is the assignment specs and then the code I have written will be below that. Thanks! Develop a Swift program to calculate the amount of a mortgage payment. The program should print out the correct value (in dollars and cents) of the monthly payment of principal and interest (ignore escrow accounts, taxes, and insurance) for the following scenarios: 72 month loan of $20,000, 4.4% APR, compounded monthly and 30 year loan of $150,000, 5% APR, one annual payment each year for 30 years. Note that you should enter the interest rate per period, as stated above. Write an iOS app for a loan payment calculator. The user interface should have Three text boxes, with labels, for Loan amount in dollars, Number of payments, Interest rate per payment period, A button to calculate the amount of the payment. A label for the payment amount. When the button is clicked, the number for the payment amount that is correct for the numbers presently in the text boxes should appear beside the label for the payment amount.
CODE:
@IBOutlet weak var Mortgage_Payment_Calculator: UILabel!
@IBOutlet weak var Loan_Amount_in_Dollars: UILabel!
@IBOutlet weak var Loan_Amount_text_field: UITextField!
@IBOutlet weak var Number_of_Payments: UILabel!
@IBOutlet weak var Number_of_Payments: UITextField!
@IBOutlet weak var Interest_rate_per_payment_period: UILabel!
@IBOutlet weak var Interest_rate_text_field: UITextField!
@IBOutlet weak var Payment_amount: UILable!
override func viewDidLoad() {
super.viewDidLoad() }
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning() }
@IBAction func Calculate_amount(_sender: AnyObject) {
var loan = Int(Loan_amount_text_field.text!)
var interest = Int(Interest_rate_text_field.text!)
var payments = Int(Number_of_payments_text_field.text!)
var amount = loan! * interest! / payments!
Payment_amount.text = String(amount) } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
