Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7518295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:43:51+00:00 2026-05-30T01:43:51+00:00

Okay, so I have a little assignment to do which needs some array of

  • 0

Okay, so I have a little assignment to do which needs some array of classes and calling various methods to get the job done. Essentially, I am looking to learn a bit through this program as well and the idea of it is to create a customer account, deposit, withdraw etc. I have written this code so far and I am getting the errors that I gave below. Please help me out in any way possible. And is var++ not an allowed option to increment a number in Java??

import java.util.*;

public class Bank
    {
        int cId;
        String cName;
        float cBalance;
    }
class Banking
{
public static void main(String args[])
{


    int limit=1;
    System.out.println(+limit);
    while (limit==1)
    {
    System.out.println("Menu:");
    System.out.println("1. Add Customer");
    System.out.println("2. View Customer Details");
    System.out.println("3. Banking Options");
    System.out.println("Enter choice:");
    Scanner scan = new Scanner (System.in);
    int i=scan.nextInt();
    switch (i)
    {
        case 1:
            {
                System.out.println("Add the customer");
                Customer();
            }
        /*case 2:
            {
                System.out.println("Customer details");
                getCustomer();
            }
        case 3:
            {
                System.out.println("Banking options");
                System.out.println("1. Deposit");
                System.out.println("2. Withdraw");
                System.out.println("3. Balance Enquiry");
                Scanner scan1 = new Scanner (System.in);
                int j=scan1.nextInt();
                switch (j)
                {
                    case 1:
                        {
                                                           System.out.println("Deposit");
                            deposit();
                        }
                    case 2:
                        {
                                                           System.out.println("Withdraw");
                            withdraw();
                        }
                    case 3:
                        {
                                                           System.out.println("Balance Enquiry");
                            balance();
                        }
                }
            }
    }   */
    System.out.println("Enter 0 to exit or 1 to continue operations");
    Scanner s = new Scanner (System.in);
    limit=scan.nextInt();
    }
}
}
}
public static void Customer (String []a)
{
    int cust=0;
    Bank c[cust] = new Bank();
    System.out.println("Enter customer ID:");
    Scanner scan11 = new Scanner (System.in);
    int k=scan11.nextInt();
    c[cust].cId=k;
    System.out.println("Enter customer name:");
    Scanner scan12 = new Scanner (System.in);
    String name=scan12.next();
    c[cust].cName=name;
    System.out.println("Enter starting balance:");
    Scanner scan132 = new Scanner (System.in);
    float bal=scan132.nextFloat();
    c[cust].cBalance=bal;

    System.out.print("Customer id=" +c[cust].cId );
    cust++;


}

}

And the errors are given here:

bank.java:73: class, interface, or enum expected
        public static void Customer (String []a)
                      ^
bank.java:76: class, interface, or enum expected
                Bank c[cust] = new Bank();
                ^
bank.java:77: class, interface, or enum expected
                System.out.println("Enter customer ID:");
                ^
bank.java:78: class, interface, or enum expected
                Scanner scan11 = new Scanner (System.in);
                ^
bank.java:79: class, interface, or enum expected
                int k=scan11.nextInt();
                ^
bank.java:80: class, interface, or enum expected
                c[cust].cId=k;
                ^
bank.java:81: class, interface, or enum expected
                System.out.println("Enter customer name:");
                ^
bank.java:82: class, interface, or enum expected
                Scanner scan12 = new Scanner (System.in);
                ^
bank.java:83: class, interface, or enum expected
                String name=scan12.next();
                ^
bank.java:84: class, interface, or enum expected
                c[cust].cName=name;
                ^
bank.java:85: class, interface, or enum expected
                System.out.println("Enter starting balance:");
                ^
bank.java:86: class, interface, or enum expected
                Scanner scan132 = new Scanner (System.in);
                ^
bank.java:87: class, interface, or enum expected
                float bal=scan132.nextFloat();
                ^
bank.java:88: class, interface, or enum expected
                c[cust].cBalance=bal;
                ^
bank.java:90: class, interface, or enum expected
                System.out.print("Customer id=" +c[cust].cId );
                ^
bank.java:91: class, interface, or enum expected
                cust++;
                ^
bank.java:94: class, interface, or enum expected
        }
        ^
17 errors

Thanks a lot guys!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:43:51+00:00Added an answer on May 30, 2026 at 1:43 am

    Regarding:

    bank.java:73: class, interface, or enum expected
            public static void Customer (String []a)
    

    Usually this means look at the line above. You may be missing a semicolon or have too many or too few curly braces. Make sure that your curly braces line up exactly, and good code formatting and indentation will help you in doing this. By the way, your formatting is horrible and this is contributing to your not finding your errors.

    This line: Bank c[cust] = new Bank();
    makes no sense whatsoever. what are you trying to do here?

    Most important: read the tutorials and learn the basics. Add small amounts of code at a time and compile frequently. Don’t add any new code until all compilation problems are solved, else you’ll end up with nothing more than a rat’s nest of errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay I have updated my code a little, but I am still not exactly
Okay I have this RewriteRule which is supposed to redirect any request for the
Okay I have a series of objects based on a base class which are
Okay so I have the following Code which appends a string to another in
Okay, so we have a utility here in-house that generates business-model classes from our
Okay since I have little experience with this stuff and the Facebook documentation is
Okay so this is for a school assignment. I have had no problems doing
Okay, the post title might be a little confusing. I have this code: class
Okay, I am a little confused because this code was working and for some
I'm working on a little project, basically I have some text on my PHP/HTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.