0% found this document useful (0 votes)
172 views

Car Core Java Question 1

The document describes requirements for creating a Customer class to manage customers for a car service center application. The Customer class should include private attributes for customer details, with public getters and setters. Constructors should allow initializing a customer with or without an ID. The toString method should display customer name and contact details. The equals method should check if two customers are the same based on name, email, and phone number (ignoring case). Sample inputs and outputs are provided to test creating Customer objects and comparing them.

Uploaded by

Amul Chiluveru
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views

Car Core Java Question 1

The document describes requirements for creating a Customer class to manage customers for a car service center application. The Customer class should include private attributes for customer details, with public getters and setters. Constructors should allow initializing a customer with or without an ID. The toString method should display customer name and contact details. The equals method should check if two customers are the same based on name, email, and phone number (ignoring case). Sample inputs and outputs are provided to test creating Customer objects and comparing them.

Uploaded by

Amul Chiluveru
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Car-Service Management System - Requirement 1

Your friend, a mechanical engineer is very passionate about cars and wants to be an entrepreneur.
He decides to start his own car service center and with his knowledge about cars has the capability
to service all different brands of cars. You are also very keen to help him out in any means possible.
One fine day, your friend approaches you to help him setup and automate the process of tracking
various customers and their service feedbacks. You decide to quickly build a small system to solve
the problem.
Based on the class diagram given below, you start to build a prototype of the application.

Requirement 1:

Let’s start off by creating a customer class based on the below mentioned specifications.

a. Create a Customer Class with the following attributes:

Member Field Name Type


customerId Long
firstName String
lastName String
gender String
email String
phoneNumber String
address String

b. Mark all the attributes as private

c. Create / Generate appropriate Getters & Setters


d. Add a default constructor and a parameterized constructor to take in all attributes in the
given order: Customer(Long customerId, String firstName, String lastName, String
gender, String email, String phoneNumber, String address)
e. When the “customer” object is printed, it should display the following details:
[Override the toString method]
Print format:
Customer:firstname,lastname
Contact details:phoneNumber,email,address
f. Two customers are considered same if they have the same name (both firstname and
lastname), email and phone number. Implement the logic in the appropriate function.
(Case – Insensitive) [Override the equals method]
The Input to your program would be details of two customers, you need to display their details
as given in "requirement e" and compare the two customers and display if the customers are
same or unique.

Sample INPUT & OUTPUT 1:

Customer1 :
customer id:
1
first name:
Arun
last name:
Kumar
gender:
Male
email:
[email protected]
phone number:
9897969594
address:
Coimbatore North
Customer2 :
customer id:
123
first name:
Arun
last name:
Kumar
gender:
Male
email:
[email protected]
phone number:
9897969594
address:
Coimbatore North

Customer 1
Customer:Arun,Kumar
Contact details:9897969594,[email protected],Coimbatore North

Customer 2
Customer:Arun,Kumar
Contact details:9897969594,[email protected],Coimbatore North
Customer 1 is same as Customer 2
Sample Input and Output 2:
Customer1 :
customer id:
1
first name:
Vijay
last name:
Kumar
gender:
Male
email:
[email protected]
phone number:
9876541234
address:
North Chennai
Customer2 :
customer id:
23
first name:
Karmega
last name:
Kulazhi
gender:
Female
email:
[email protected]
phone number:
7785674563
address:
Kurangani, Theni, Tamilnadu

Customer 1
Customer:Vijay,Kumar
Contact details:9876541234,[email protected],North Chennai

Customer 2
Customer:Karmega,Kulazhi
Contact details:7785674563,[email protected],Kurangani, Theni, Tamilnadu
Customer 1 and Customer 2 are different

You might also like