Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with create a method in the bank class such as checkSSN(int ssn) that is checking if ssn is already present in the system and

Help with create a method in the bank class such as checkSSN(int ssn) that is checking if ssn is already present in the system and if the system has a ssn it will send false else true, how would that method look? Thanks!

Below java code is from the swith/case main class

Problem: If user by mistake enter a ssn that's already exists, shall not be possible.

switch (choice) {

case 1: {

while(true) {

System.out.print("Enter customer unique ssn: ");

ssn = sc.nextInt();

if(bank.checkSsn(ssn)){

break;

}

else{

System.out.println("Please enter a unique ssn:");

}

}

System.out.print("Enter customer name: ");

sc.nextLine();

String name = sc.nextLine();

Customer customer = new CustomerBuilder().setSsn(ssn).setName(name).createCustomer();

Bank.addCustomer(customer);

System.out.println(" Customer added successfully with uniquely ssn: " + customer.getSSN());

}

break;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

LO2 Explain the nature of the psychological contract.

Answered: 1 week ago