Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
65 lines (53 loc) · 2.11 KB

File metadata and controls

65 lines (53 loc) · 2.11 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import java.util.Map;
import com.h2.SavingsCalculator;
import com.h2.MortgageCalculator;
import com.h2.BestLoanRates;
public class Finance {
public static final String BEST_LOAN_RATES="bestLoanRates";
public static final String SAVINGS_CALCULATOR="savingsCalculator";
public static final String MORTGAGE_CALCULATOR ="mortgageCalculator";
public static final Map<String, String> commandsToUsage = Map.of (
BEST_LOAN_RATES, "usage: bestLoanRates",
SAVINGS_CALCULATOR, "usage: savingsCalculator <credits separated by ','> <debits separated by ','>",
MORTGAGE_CALCULATOR, "usage: mortgageCalculator <loanAmount> <termInYears> <annualRate>");
private static boolean validateCommandArguments(String[] args) {
switch (args[0]) {
case BEST_LOAN_RATES:
return args.length == 1;
case SAVINGS_CALCULATOR:
return args.length == 3;
case MORTGAGE_CALCULATOR:
System.out.println(MORTGAGE_CALCULATOR);
return args.length == 4;
}
return false;
}
private static void executeCommand(String command, String[] arguments) {
final String loanAmount = "264000";
final String termInYears = "30";
final String annualRate = "3.74";
switch (command) {
case BEST_LOAN_RATES:
System.out.println("Finding best loan rates ...");
BestLoanRates.main(null);
break;
case SAVINGS_CALCULATOR:
System.out.println("Finding your net savings ...");
SavingsCalculator.main(null);
break;
case MORTGAGE_CALCULATOR:
System.out.println("Finding your monthly payment ...");
MortgageCalculator.main(null);
break;
}
return;
}
public static void main (String[] args) {
String command = args[0];
if (!commandsToUsage.containsKey(command)) {
System.out.print(args[0]);
System.out.print(": command not found\n");
}
return;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.