Crud Operations
Crud Operations
Crud Operations
int userId;
String emailId;
String password;
String firstName;
String lastName;
String gender;
String phoneNo;
String city;
public Admin(){
super();
}
public Admin(int userId, String emailId, String password, String firstName, String
lastName,, String city String gender, String phoneNo ){
super();
this.userId = userId;
this.emailId = emailId;
this.password = password;
this.firstName = firstName;
this.lastName = lastName;
this.city = city;
this.gender = gender;
this.phoneNo;
@Override
public String toString(){
return "Customer[userId="+userId+", emailId="+emailId+",password
="+password+" ,firstName="+firstName+", lastName="+lastName+",city =
"+city+",gender = "+gender+",phoneNo = "+phoneNo+"]";
}
}
interface CustomerService{
void createCustomer(Customer customer);
Customer updateAdmin(Customer customer);
void deleteCustomer(int id);
Customer[] getCustomer();
}
@Override
public void createCustomer(Customer Customer)
{
CustomerArray[count] = Customer;
count++;
}
@Override
public Admin updateCustomer(Customer customer)
{
for(int i = 0; i < customerArray.length; i++)
{
if(customerArray[i].getuserId() == customer.getuserId()){
customerArray[i] = customer;
return customer;
}
}
return customer;
}
@Override
public void deleteCustomer(int userId)
{
for(int i = 0; i < adminArray.length; i++)
{
if(customerArray[i].getuserId() == userId)
{
adminArray[i] = null;
}
}
}
@Override
public Customer[] getcustomer(){
return customerArray;
}
}
System.out.println(rajan);
}
}