-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathClient.java
More file actions
24 lines (20 loc) · 861 Bytes
/
Client.java
File metadata and controls
24 lines (20 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.premaseem;
import java.util.Scanner;
/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
public class Client {
public static void main (String[] args) {
System.out.println("Strategy Design pattern - Mountaineering app ");
System.out.println("Lets decide the strategy to cross mountain crevasse ");
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the distance of crevasse ...");
int distance = scanner.nextInt();
Context context = new Context();
CrevasseCrossingStrategy crossingStrategy = context.getCrevasseCrossingStrategy(distance);
System.out.println("Using Strategy : "+ crossingStrategy.getClass().getSimpleName());
crossingStrategy.crossCrevasse();
}
}