Customer Class With Constructor

 CUSTOMER.JAVA:

 public class Customer{
	//Fill your code
	private String	customerName;
	private	String	customerEmail;
	private	String	customerType;
	private	String	customerAddress;
	private Customer() {
		// TODO Auto-generated constructor stub
	}

	
	


	

 public Customer(String customerName, String customerEmail, String customerType, String customerAddress) {
		super();
		this.customerName = customerName;
		this.customerEmail = customerEmail;
		this.customerType = customerType;
		this.customerAddress = customerAddress;
	}







public String getCustomerName() {
	return customerName;
}







public void setCustomerName(String customerName) {
	this.customerName = customerName;
}







public String getCustomerEmail() {
	return customerEmail;
}







public void setCustomerEmail(String customerEmail) {
	this.customerEmail = customerEmail;
}







public String getCustomerType() {
	return customerType;
}







public void setCustomerType(String customerType) {
	this.customerType = customerType;
}







public String getCustomerAddress() {
	return customerAddress;
}







public void setCustomerAddress(String customerAddress) {
	this.customerAddress = customerAddress;
}






public void displayDetails(){
		System.out.println("Name: "+customerName);
		System.out.println("E-mail: "+customerEmail);
		System.out.println("Type: "+customerType);
		System.out.println("Location: "+customerAddress);

			//Fill your code

	}
	
}




MAIN.JAVA:

 import java.io.*;
import java.util.*;
public class Main {
	 

	
	public static void main(String[] args) throws Exception, IOException {
		

				//Fill your code
		Scanner sc= new Scanner(System.in);
		
		System.out.println("Enter the name");
		String name= sc.nextLine();
		System.out.println("Enter the email");
		String email= sc.nextLine();
		System.out.println("Enter the type");
		String type= sc.nextLine();
		System.out.println("Enter the location");
		String address= sc.nextLine();
		Customer customer = new Customer(name,email,type,address);
		customer.displayDetails();

	}
}

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.