0% found this document useful (0 votes)
5 views2 pages

Java and Python Customer Class Example

The document outlines the structure of a Customer class in both Java and Python, highlighting the use of static variables and multiple constructors. It includes method signatures for registration and login, as well as an example of instantiation. Additionally, it presents a BankAccount class with methods for depositing money.

Uploaded by

zh5chenx1
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Java and Python Customer Class Example

The document outlines the structure of a Customer class in both Java and Python, highlighting the use of static variables and multiple constructors. It includes method signatures for registration and login, as well as an example of instantiation. Additionally, it presents a BankAccount class with methods for depositing money.

Uploaded by

zh5chenx1
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

public void register(int a)

SIGNATURE:
- returned value
- modifiers (if necessary)
- name of the method
- passed parameters

JAVA

class Customer{
static counter=0; /* TODOS LOS CUSTOMERS TIENEN EL
MISMO COUNTER. SI LO CAMBIO EN UNO, LO CAMBIO EN
TODOS*/

int customerId;
String name;
String email;
String address;

Customer(){ }
Customer(int d){ } //JAVA ALLOWS MULTIPLE
CONSTRUCTORS
Customer (String name){ }

void register(){
}
void login(){
}
}

LINEA DE INSTANTIATION in JAVA


Customer Ian=new Customer(1,”Ian”, “Ian@[Link]”,”Ves a saber on”);

class BankAccount{
String owner;
Dollars balance;

BankAccount(String owner, Dollars balance){ }


void depòsit(Dollars amount){ }
}
PYTHON

def Customer:
counter=0 //SI LO CAMBIO EN UNO LO CAMBIO EN TODOS

def __Customer__(self, int customerId, string name, string email, string address)
[Link]=customerId
[Link]=name
[Link]=email
[Link]=address

Customer(1,“Ian”,”ian@[Link]”,”Ves a saber on”)

You might also like