Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class User {
- Scanner secondInput = new Scanner(System.in);
- protected String username = "phantomblade";
- protected String username1 = "lucario";
- protected String password = "shadows";
- protected String password1 = "lighting";
- protected String bank = "DSK";
- protected String notDone = "yes";
- protected static String addMoney = "AddMoney";
- protected static String pullingMoney = "PullingMoney";
- protected static String checkingAccount = "CheckingAccount";
- protected double account = 1000;
- protected User(String username, String password) {
- this.password = password;
- this.username = username;
- this.account = 1000;
- }
- public User() {
- }
- protected String getPassword() {
- return password;
- }
- protected String getUsername() {
- return username;
- }
- protected String getAddMoney() {
- return addMoney;
- }
- protected String getPullingMoney() {
- return pullingMoney;
- }
- protected String getCheckingAccount() {
- return checkingAccount;
- }
- public double getAccount() {
- return account;
- }
- public String getBank() {
- return bank;
- }
- public String getNotDone() {
- return notDone;
- }
- public String getUsername1() {
- return username1;
- }
- public String getPassword1() {
- return password1;
- }
- protected double addMoney(int t) {
- double account = 1000;
- account += t;
- return account;
- }
- protected double pullingMoney(int v) {
- double account = 1000;
- account -= v;
- return account;
- }
- protected double checkingAccount() {
- return account;
- }
- protected double getResult(double K0, double n, double p) {
- return K0 * Math.pow((1 + (p / 100)), n);
- }
- protected int calculatingYear() {
- User kris = new User();
- int year = 2010;
- System.out.println("Please tell us what year did you deposit your money ");
- int inputYear = secondInput.nextInt();
- int result = 0;
- if (inputYear > 2010) {
- result = inputYear - year;
- System.out.println(
- "It seems your money are deposed here more than 1 year so you can get our bank interest rate bonus to your monney :)");
- System.out.println("Your money have been here for " + result + " years");
- System.out.println("Please input the interest rate of the bank");
- String interestRate = secondInput.next();
- double interestRate1 = Double.parseDouble(interestRate);
- System.out.println(interestRate1 + "%");
- secondInput.nextLine();
- System.out.println(
- "So the total cash now you have is " + kris.getResult(kris.getAccount(), result, interestRate1));
- }
- secondInput.close();
- return result;
- }
- protected boolean finishing() {
- boolean b = true;
- ArrayList<String> arrayList = new ArrayList<String>();
- Scanner input = new Scanner(System.in);
- System.out.println("How much accounts,would you like to check today sir?");
- int x = input.nextInt();
- User kris = new User();
- for (int numberOfAccount1 = 0; numberOfAccount1 <= x; numberOfAccount1++) {
- System.out.println("Write your username: ");
- String username = input.next();
- arrayList.add(username);
- System.out.println("Write your password: ");
- String password = input.next();
- arrayList.add(password);
- String str2 = input.next();
- System.out.println("Welcome " + username + " to " + str2 + " bank " + " ! ");
- }
- System.out.println("What would you like to do today with your account? ");
- String operation = input.next();
- if (kris.getCheckingAccount().equals(operation)) {
- System.out.println(kris.calculatingYear());
- }
- if (kris.getPullingMoney().equals(operation)) {
- System.out.println("Ok so you want to pull money,please tell me how much money do you want to take sir");
- int v = input.nextInt();
- input.nextLine();
- System.out.println("You now have " + kris.pullingMoney(v));
- }
- if (kris.getAddMoney().equals(operation)) {
- System.out.println("Ok so you want add money,please tell me how much money do you want to add sir");
- int t = input.nextInt();
- input.nextLine();
- System.out.println("You now have left " + kris.addMoney(t));
- }
- input.close();
- return b;
- }
- }
- /*
- * @Override public boolean equals(Object arg0) { if (!(arg0 instanceof User))
- * return false; User user2 = (User) arg0; if
- * (user2.username.equals(this.username) &&
- * user2.password.equals(this.password)) { return true; } return false; }
- */
Add Comment
Please, Sign In to add comment