// // ViewController.swift // SemesterGrade-APP // import UIKit class ViewController: UIViewController { // FINISH ME // link to your first TextField box @IBOutlet weak var quarter1TextField: UITextField! // FINISH ME // link to your second TextField box @IBOutlet weak var quarter2TextField: UITextField! // FINISH ME // link to your third TextField box @IBOutlet weak var examTextField: UITextField! // FINISH ME // link to your semester average Label @IBOutlet weak var semesterAverageLabel: UILabel! // FINISH ME // link to your calculate Button @IBAction func calculateButtonEvent(_ sender: UIButton) { // FINISH ME // get the q1Grade // first get the text from quarter1TextField and unwrap it // then convert this to a Double // i.e. Double(the text unwrapped) let q1Grade ? ?????(????) // FINISH ME // get the q2Grade // first get the text from quarter2TextField and unwrap it // then convert this to a Double let q2Grade ? ?????(????) // FINISH ME // get the examGrade // first get the text from examTextField and unwrap it // then convert this to a Double let examGrade = ?????(????) // FINISH ME // we now let Apple unwrap the optionals and store the number // into q1Grade, q2Grade, and examGrade (use shadowing) if let q1Grade = ?????, let ???? = ?????, let ???? = ????? { // FINISH ME // set semesterAverage to: // 40% of q1Grade plus 40% of q2Grade plus 20% of examGrade let semesterAverage = ?????? // FINISH ME // set semesterAverageLabel to say "Average: ???" // where ??? is replaced by the semesterAverage semesterAverageLabel.text = ???? } else { // FINISH ME // set semesterAverageLabel to say "Error" semesterAverageLabel.text = ????? } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }