The program consists of 5 classes: SavingsAccount class, RspAccount class, Client class, Bank class and Machine class.
Im done with the SavingsAccount class and the RspAccount class and the class im having trouble with is the Client class.
The client class models a client, who can have at most one savings account and one Rsp account. (our program consists of only one client, since we havent covered arrays yet) Our class should have the following public constructor: Client (String name, int id, int pin) and it should have the following public methods:
String get_name() which gets the name of the client
int get_id() which gets the ID of the client
void set_id(int id) which sets the ID of the client
int get_pin() which gets the PIN of the client
void set_pin(int pin) which sets the PIN of the client
SavingsAccount get _savings() which gets savings account of the client & returns null if he hasnt one
void set_savings(SavingsAccount sa) which sets the savings account of the client
RspAccount get_rsp() which gets Rsp account of a client & returns null if he hasnt one
void set_rsp(RspAccount ra) which sets Rsp account of the client
boolean has_savings() which returns true if client has savings account, false if he hasnt
boolean has_rsp() which returns true if client has rsp account, false if he hasnt
double total_asset() returns the client's total assets in existing accounts
SO.. here is my client class (What ive done so far, which i know isnt enough, but im suck and i absolutely need help.. im not looking for code answer, just hints anything, i cant apply classes methods, i dont know how to call objects, to get my client class working, etc..Thank you so much in advance, to whoever will be the one helping me..thanks a lot)
import java.util.Scanner;
public static void main (String [] args){
Scanner scanner = new Scanner (System.in);
}
public class Client {
String clientName = "";
int clientID;
int clientPIN;
public Client (String name, int id, int pin){ // this is the constructor (same name as class)
clientName = name;
clientID = id;
clientPIN = pin;
}
public String get_name(){ // gets the client's name
System.out.println("Please enter your name:");
name = scan.next() + " " + scan.next();
return name;
}
public int get_id (){ // gets the client's ID
System.out.println("Please enter your ID");
id = scan.nextInt();
return id;
}
public void set_id (int id){ // sets client's ID
// what do we put here?
}
public int get_pin (){ // gets client's PIN
System.out.println("Please enter your PIN code");
pin = scan.nextInt();
return pin;
}
public void set_pin (int pin){ // sets client's PIN
// what do we put here?
}
public SavingsAccount get_savings (){
// gets SavingsAccount (the object which represents the client's savings account) of client if he has one, if
// not, returns Null (how do u do that?)
}
public void set_savings (SavingsAccount sa){
// what do we put here? it sets the savingsaccount of client, if he has one. The set_savings() method does
// the opposite. It sets the client's savings
// account to the oject that is the parameter of the method. It was not specified what the method should do
// if the client already has a savings account. You can do whatever you think is appropriate in that case
}
public void set_rsp (RspAccount ra){
// what do we put here?
}
public boolean has_savings (){
// returns true if client has savingsaccount, false if not. How do we do that?
}
public boolean has_rsp (){
// returns true if client has rsp account, false if not. How do we do that?
}
public double total_asset (){
// returns client's total asset in existing accounts. How do we do that?
}
}
thank you so much once again, to whoever will help..

New Topic/Question
Reply




MultiQuote



|