Hello guys,
I've recently started programming in Java, and I need help with one "assignment" that I found on one of our universitys website (Norwegian).
It's like this ( I will translate as good as I can, please leave a message if you don't understand ):
< necessary import-packages >
public class Account
{
< Data fields for the account holder's name, account number and balance. >
< Constructor which initializes the account holder's name, account number and balance. >
< set-method for account holder's name >
< get-method for account holder's name, account number and balance >
< Account print-out method, which prints the account holder
name, account number and balance in a dialog. >
< Metode som setter inn et beløp på kontoen.
Beløpets størrelse skal tas imot via en parameter til metoden.
Metoden skal returnere en tekst som inneholder informasjon om
den nye saldoen. >
} // end of class Account
I belive it's something like this:
import javax.swing.JOptionPane;
public class Account
{
private String name;
private long number;
private double balance;
public Account (String n, long nr, double s)
{
name = n;
number = nr;
balance = s;
}
public void setAccountname(String Accountname)
{
name = Accoutname;
}
public String getAccountname()
{
return name;
}
public long getAccountnumb()
{
return number;
}
public double getAccountbalance()
{
return balance;
}
public void visTittel()
{
JOptionPane.showMessageDialog(null, "Account holder's name: " + name + "\n"
+ "Account number: " + number + "\n"
+ "Balance: " + balance);
}
Is it right? Or is something wrong with this? Anyways, to my problem. Here is a pseudo-code for the main method:
< necessary import-settings >
public class Accountest
{
public static void main(String[] args)
{
< Create two Account-objects, which in the establishment is provided each name, each account number and each balance. >
< Test in ALL of the methods you've created in the Account-class at the
Account objects. Write the results on the screen.
Use the dialog windows for both scanning and printing.. >
}
} // end of class Kontotest
Well, I didn't understand this, and was wondering if any of you could help me with this? What should I do? What does the program want (didn't understand)..
Thanks in advance :)