01: package org.acme.insurance;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: /**
20: * This represents a policy that a driver is applying for.
21: *
22: * Obviously in the real world, there are actuaries to mess things up, but lets just pretend there is
23: * some simple base price and discount that we can calculate with relatively simple rules !
24: *
25: * @author Michael Neale
26: */
27: public class Policy {
28:
29: private String type = "COMPREHENSIVE";
30: private boolean approved = false;
31: private int discountPercent = 0;
32: private int basePrice;
33:
34: public boolean isApproved() {
35: return approved;
36: }
37:
38: public void setApproved(boolean approved) {
39: this .approved = approved;
40: }
41:
42: public int getDiscountPercent() {
43: return discountPercent;
44: }
45:
46: public void setDiscountPercent(int discountPercent) {
47: this .discountPercent = discountPercent;
48: }
49:
50: public String getType() {
51: return type;
52: }
53:
54: public void setType(String type) {
55: this .type = type;
56: }
57:
58: public void applyDiscount(int discount) {
59: discountPercent += discount;
60: }
61:
62: public int getBasePrice() {
63: return basePrice;
64: }
65:
66: public void setBasePrice(int basePrice) {
67: this.basePrice = basePrice;
68: }
69:
70: }
|