SwiftBank Project: Properties and Access Control (Swift)

Hey Codecademy,

Can someone please have a relook at the SwiftBank Project? Steps 7-8 were not very clear and the “Hints” were not helpful. I found myself looking at the Solution on GitHub to just get past those two steps, which is frustrating because the course project should help lead you to finishing it on your own. I eventually understood what was being asked of me in Steps 7-8 after reading the code on GitHub, and honestly from the directions and hints the project gave for those steps there was no way I would have known/figured them out on my own.

PLEASE have a relook at the project.

Also, the FAQ on this skill path lesson does not have a thread specifically for this Project, I would recommend one being made. @discourse-admin

-N

Hey were you ever able to find a solution for this? I’m currently stuck on #7-8 and can’t find a walkthrough anywhere.

struct SwiftBank {
 private let password: String
 init(password: String){
   self.password = password
 }

// #4: Check if the user is authorized
private func isValid(_ enteredPassword: String) -> Bool {
  if enteredPassword == password {
   return true 
   } else {
   return false
  }
 }

// #5: Enable deposits
 private var balance: Double = 0

// #6: Set the rate of the bonus
 static let depositBonusRate = 0.01

// #7: Calculate total deposits
 private func finalDepositWithBonus(fromInitialDeposit deposit: Double) -> Double {
  return deposit + (deposit * SwiftBank.depositBonusRate)
 }

// #8: Making Deposit
mutating func makeDeposit(ofAmount depositAmount: Double){
   let depositWithBonus = finalDepositWithBonus (fromInitialDeposit: depositAmount)
   
   print("Making a deposit of $\(depositAmount) with a bonus rate. The final amount deposited is $\(depositWithBonus).")
 
   balance += depositWithBonus
 }
}
1 Like