Question: I made a program that accepts numbers from the user.

Sample of my program:

```
   int strength, health, luck;

JOptionPane.showMessageDialog(null,"Welcome to Yertle's Quest");    

      String name = JOptionPane.showInputDialog("Enter the name of your character");

       Scanner in = new Scanner(System.in);
     System.out.println("Enter strength (1-10): ");
      strength = in.nextInt();

     System.out.println("Enter health (1-10): ");      
      health = in.nextInt();

     System.out.println("Enter luck (1-10): ");      
      luck = in.nextInt(); 

```

My problem is this:
The user is only able to give 15 points. If he puts more than 10 points to each stats (strength,health,luck), the default value will be assign to each stats -which is 5. And if the total points on each stats(strength,health,luck) is more than 15, the default value will be assigned to each stats.

Answer: 
```
Xcode 7.1 - Swift 2.0

//Adding Title Label
        var navigationTitlelabel = UILabel(frame: CGRectMake(0, 0, 200, 21))
        navigationTitlelabel.center = CGPointMake(160, 284)
        navigationTitlelabel.textAlignment = NSTextAlignment.Center
        navigationTitlelabel.textColor  = UIColor.whiteColor()
        navigationTitlelabel.text = "WORK ORDER"
        self.navigationController!.navigationBar.topItem!.titleView = navigationTitlelabel

```
I used this code for swift 4 (note label rect is NOT important..)

```
func navBar()->UINavigationBar?{
        let navBar = self.navigationController?.navigationBar
        return navBar
    }

override func viewDidLoad() {
        super.viewDidLoad()

        setTNavBarTitleAsLabel(title: "VERYYYY VERYYYY VERYYYY VERYYYY VERYYYY VERYYYY VERYYYY LONGGGGGG")
    }

    // will shrink label...

    func setTNavBarTitleAsLabel(title: String, color: UIColor ){

        // removed some code..

        let navigationTitlelabel = UILabel(frame: CGRect(x: 0, y: 0, width: 20, height: 20))
        navigationTitlelabel.numberOfLines = 1
        navigationTitlelabel.lineBreakMode = .byTruncatingTail

        navigationTitlelabel.adjustsFontSizeToFitWidth = true
        navigationTitlelabel.minimumScaleFactor = 0.1
        navigationTitlelabel.textAlignment = .center
        navigationTitlelabel.textColor  = color
        navigationTitlelabel.text = title

        if let navBar = navBar(){
            //was navBar.topItem?.title = title

            self.navBar()?.topItem?.titleView = navigationTitlelabel
            //navBar.titleTextAttributes = [.foregroundColor : color ?? .black]
        }
    }

```