Skip to content

Commit

Permalink
Merge pull request #1 from GREENOVER/step1
Browse files Browse the repository at this point in the history
Step1 쥬스 메이커 타입 정의
  • Loading branch information
GREENOVER committed Nov 17, 2020
2 parents a02ced5 + 1af6679 commit cee5798
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 15 deletions.
1 change: 0 additions & 1 deletion JuiceMaker/JuiceMaker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
Expand Down
86 changes: 80 additions & 6 deletions JuiceMaker/JuiceMaker/JuiceMaker.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,83 @@
//
// JuiceMaker - JuiceMaker.swift
// Created by yagom.
// Copyright © yagom academy. All rights reserved.
//
//그린

// 쥬스 메이커 타입

import Foundation

/// 쥬스 메이커 타입
enum Juice {
case strawberryJuice
case bananaJuice
case pineappleJuice
case kiwiJuice
case mangoJuice
case strawberryBananaJuice
case mangoKiwiJuice
}

enum Fruit {
case strawberry
case banana
case pineapple
case kiwi
case mango
}

class JuiceMaker {
var strawberryStock: Int = 10
var bananaStock: Int = 10
var pineappleStock: Int = 10
var kiwiStock: Int = 10
var mangoStock: Int = 10

func makeJuice(_ juice: Juice) {
switch juice {
case .strawberryJuice:
strawberryStock -= 3
case .bananaJuice:
bananaStock -= 3
case .pineappleJuice:
pineappleStock -= 3
case .kiwiJuice:
kiwiStock -= 3
case .mangoJuice:
mangoStock -= 3
case .strawberryBananaJuice:
strawberryStock -= 10
bananaStock -= 1
case .mangoKiwiJuice:
mangoStock -= 2
kiwiStock -= 1
}
}

func addFruitStock(_ fruit: Fruit) {
switch fruit {
case .strawberry:
strawberryStock += 1
case .banana:
bananaStock += 1
case .pineapple:
pineappleStock += 1
case .kiwi:
kiwiStock += 1
case .mango:
mangoStock += 1
}
}

func removeFruitStock(_ fruit: Fruit) {
switch fruit {
case .strawberry:
strawberryStock -= 1
case .banana:
bananaStock -= 1
case .pineapple:
pineappleStock -= 1
case .kiwi:
kiwiStock -= 1
case .mango:
mangoStock -= 1
}
}
}

10 changes: 2 additions & 8 deletions JuiceMaker/JuiceMaker/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
//
// JuiceMaker - ViewController.swift
// Created by yagom.
// Copyright © yagom academy. All rights reserved.
//
//GREEN

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}



}

0 comments on commit cee5798

Please sign in to comment.