Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Order {
- private String customerName;
- private int numberOfGarments;
- public Order() {
- this.customerName = "";
- this.numberOfGarments = 0;
- }
- public Order(String customerName) {
- this(customerName, 0);
- }
- public Order(String customerName, int numberOfGarments) {
- this.customerName = customerName;
- this.numberOfGarments = numberOfGarments > -1 ? numberOfGarments : 0;
- }
- public void setCustomerName(String customerName) {
- this.customerName = customerName;
- }
- public void setNumberOfGarments(int numberOfGarments) {
- this.numberOfGarments = numberOfGarments > -1 ? numberOfGarments : 0;
- }
- public String getCustomerName() {
- return this.customerName;
- }
- public int getNumberOfGarments() {
- return this.numberOfGarments;
- }
- public double calculateCharge(double charge) {
- return (charge > -1.0) ? (numberOfGarments * charge) : 0.0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement