-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheque.java
More file actions
91 lines (67 loc) · 2.25 KB
/
Cheque.java
File metadata and controls
91 lines (67 loc) · 2.25 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//NAME:RAMLOCUND Gitendrajeet
//Algorithmics Assignment
//DATE:12.04.2021
//Creating the Cheque Class to be used for Queues.
import java.util.Scanner;
//Creating Class Cheque to be stored to an ArrayList
public class Cheque implements Comparable<Cheque> {
static int chequeNum; // Variable to Store Cheque Number last 7 characters
private String bankName; // Variable to Store Bank Name
private String name; // Variable to store Recipient Name
private String accountType; // Variable to Store Customer Account(Savings,Personal,Cooperate)
private float amount; // Variable to store Amount being deposited or credited
// Default Constructor
public Cheque() {
Scanner input = new Scanner(System.in);
chequeNum++;
System.out.print("Input Bank Name : ");
this.bankName = input.nextLine();
System.out.print("Input Recipient Name : ");
this.name = input.nextLine();
System.out.print("Input Account Type : ");
this.accountType = input.nextLine();
System.out.print("Input Cheque Amount : ");
this.amount = input.nextFloat();
}
// Parameterized constructor
public Cheque(String bkName, String name, String actype, float amt) {
chequeNum++;
this.bankName = bkName;
this.name = name;
this.amount = amt;
this.accountType = actype;
}
static int getChequeNum() {
return chequeNum++;
}
private String getName() {
return name;
}
private double getAmount() {
return amount;
}
private String getBankName() {
return bankName;
}
private String getAccountType() {
return accountType;
}
// String representation of Cheque
public String toString() {
return "\nCheque Number : " + "000 0000 000" + getChequeNum() + "\nBank Name : " + this.bankName + " PLC LTD"
+ "\nRecipient Name : " + this.name + "\nAmount : " + this.amount + " MUR" + "\nAccount Type : "
+ this.accountType + " Account";
}
// Function to Clone and make duplicates copy of a Cheque
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
// Function to Check if 2 Cheques are Equals
public boolean equals(Object obj) {
return (this == obj);
}
// Function to Compare 2 Cheques
public int compareTo(Cheque o) {
return 0;
}
}