- package JavaApplication6.src.javaapplication6;
- import java.util.Scanner;
- public class JavaApplication6 {
- public static String menu() {
- Scanner scan = new Scanner(System.in);
- System.out.println("Welcome to MarmaraBank Online System, please login to continue.");
- System.out.println("Login or Register (L/R): ");
- String st = scan.nextLine();
- st = st.toLowerCase();
- return st;
- }
- public static String mail(String name, String sname, int byear) {
- String newname = name.toLowerCase();
- String newsname = sname.toLowerCase();
- String mail = newname + "." + newsname + byear + "@account.com";
- return mail;
- }
- public static String pw(String name, String sname, int byear) {
- double num = (double)(Math.random() * 101);
- String pw = sname + "#" + Math.round(num) + "@" + name;
- return pw;
- }
- public static void main(String[] args) {
- String st = "";
- Scanner scan1 = new Scanner(System.in);
- String r = "r";
- String l = "l";
- st = menu();
- String mail = null;
- String pw = null;
- if (st.equals(r)) {
- System.out.println("You are now creating your online back account...");
- System.out.println("Enter your name: ");
- String name = scan1.nextLine();
- System.out.println("Enter your surname: ");
- String sname = scan1.nextLine();
- System.out.println("Enter your birthyear: ");
- int byear = scan1.nextInt();
- if (2021 - byear < 18) {
- System.out.println("You need to be above 18 to create a bank account.");
- }
- else {
- mail = mail(name, sname, byear);
- pw = pw(name, sname, byear);
- System.out.println("Your mail is: " + mail);
- System.out.println("Your password is: " + pw);
- System.out.println("You are now being directed to login page...");
- while (true) {
- System.out.println("Enter your mail: ");
- scan1.nextLine(); // yeni satıra geçmeyi sağlıyor galiba, bunu koymadığımda birinci inputu giremeden 2.yi istiyor
- String inp_mail = scan1.nextLine();
- System.out.println("Enter your password: ");
- String inp_pw = scan1.nextLine();
- System.out.println(inp_mail);
- System.out.println(inp_pw);
- if ((mail.equals(inp_mail)) && (pw.equals(inp_pw))) {
- System.out.println("Login successful, leading you to online banking website...");
- break;
- }
- else {
- System.out.println("Wrong mail or password");
- }
- }
- System.out.println("Choose what you want to do:");
- System.out.println("Simple Interest Calculator (1) ");
- int num2 = scan1.nextInt();
- if (num2 == 1) {
- System.out.println("Enter the amount of money: ");
- int money = scan1.nextInt();
- System.out.println("Enter the rate of interest (percentage): ");
- int interest = scan1.nextInt();
- System.out.println("Enter the time period (years): ");
- int period = scan1.nextInt();
- for (int i = 1; i <= period; i++) {
- int intr_money = money + (money*interest/100*i);
- System.out.println("Your money in " + i + " years is: " + intr_money);
- }
- }
- }
- }
- else {
- System.out.println("You need to register first.");
- }
- }
- }
[text] project
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: