As we can tell from the last coding experince I am clearly not the best at this coding thing. I know now what I need help with and how to ask so this project is "Writing a Java class definition and instantiating the class in a program"

Write the definition for a class named Bank that includes the following private attributes:
• The name of the bank (several words)
• The year the bank was established (a whole number)
• The number of customers (a whole number)
• The bank’s total assets (dollars and cents)

The class should include two constructors:
• A no-arg constructor that sets the name of the bank to “Unknown”, the year the bank was established to 2011, the
number of customers to 0, and the total assets to 0
• A constructor that has four parameters (one for each attribute) and sets each attribute equal to the corresponding
parameter.

The class should have a mutator and an accessor for each attribute. Additionally, it should have a method named
getAvgAssets that returns the amount of assets per customer (the total assets divided by the number of customers).

public class void Bank()
{
	private String bankName = "";
	private int year = 2011;
	private int customers = 0;
	private double totalAssests = 0;

So far this is what I have. Please understand I try and help myself I go to class, I listen, and take notes I just dont understand.

Recommended Answers

All 6 Replies

Do the assignment one small step at a time. Compile frequently.
Add the few statements to your code that will properly define a simple class and compile it. Add a no argument constructor and the ending }
When that works. move on to the next item in the assignment.

Take a look at this site:
http://download.oracle.com/javase/tutorial/java/TOC.html

import java.text.DecimalFormat;

public class Bank
{
	private String bankName = "";
	private int year = 2011;
	private int customers = 0;
	private double totalAssests = 0;

public Bank()
{
	bankCustomers = 0
}

public Bank()
{
	bankYear = 2011
}

public Bank()
{
	bankAssests = 0
}

public void setyear(int b)
{
    balance = b;
}

DecimalFormat dollar = new DecimalFormat("$,#0.00");

Bank bankName = new Bank(input);



public void set

is this correct so far?

is this correct so far?

It does not look like it will compile. It needs some ending }s
You should try to compile it BEFORE you post it so you can copy any error messages here.

Not really sure why you would want to set the balance in a method called "setyear". Does that seem logical to you?

Thanks for the code tags. It is much easier to read.
Now you need to compile it and copy/paste the error messages here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.