I have a few problems with my code.
- After my input for Complete Name it goes to Gender loop right away.
- My while loop in gender is not working. It's not reading the conditions I have set.
- It doesn't read a hasNext or hasNextLine in my menu because it reads the nextInt right away.
- It doesn't read a hasNext or hasNextLine in my ob because it reads the nextDouble right away.
import java.time.LocalDate;
import java.text.SimpleDateFormat;
import java.util.Date;
public class BankAccountSystem extends Bank
{
    public static void main(String[] args)
    {
        Scanner ba = new Scanner(System.in);
        Bank BankAccount = new Bank();
        int menu = 0;
        double ob = 0;
        String name, address;
        String gender = "";
        LocalDate dateToday = LocalDate.now();
        Date date = new Date();
        System.out.print("\f");
        do {
            System.out.println("\nWhat are you looking for?"
            +"\n1.) New Accounts"
            +"\n2.) Deposit"
            +"\n3.) Account Inquiry"
            +"\n4.) Account Inquiry by Date"
            +"\n5.) Inquiry by Status"
            +"\n6.) Show All Accounts"
            +"\n[Enter a num 1-6]");
            
            menu = ba.nextInt();
            switch (menu)
            {
                case 1: System.out.print("Enter complete name: ");
                while (ba.hasNextInt())
                {
                    System.out.print("Enter a valid complete name: ");
                    ba.next();
                }
                name = ba.nextLine();
                //gender loop
                System.out.print("Enter gender [M-Male or F-Female]: ");
                ba.next();
                while (!(gender == "M" && gender == "F") || ba.hasNextInt())
                {
                    System.out.print("Wrong input. Try again."
                    + "\nEnter gender [M-Male or F-Female]: ");
                    ba.next();
                }
                gender = ba.next();
                
                System.out.print("Enter Address: ");
                ba.next();
                address = ba.nextLine();
                
                System.out.print("Enter opening balance [Min: 500]: ");
                while (ob < 500 && !ba.hasNextDouble())
                {
                    System.out.print("Opening balance must be at least 500: ");
                    ba.next();
                }
                ob = ba.nextDouble();
                
                SimpleDateFormat timeNow = new SimpleDateFormat("hh:mm:ss a");
                System.out.println("\nAccount created successfully!"
                                    +"\nBank Account Number: " + BankAccount.accountNum(111,999)
                                    +"\nDate Opened: " + dateToday + " " + timeNow.format(date));
                break;
            }
        }while(menu != 0);
    }
}
 
    