New customer

Report a typo

There are three classes: an abstract class Customer with the template method, and two concrete classes, Premium and Standard.
You must implement the template method in the Customer class to create an account using the following algorithm:

  1. Verify customer's identity
  2. Generate customer's identification number
  3. Send a thank you message
  4. Send a welcome gift

Your task is to make the Premium and Standard classes inherit from the class Customer, and write the methods generateCustomerID() and sendGift() according to the console output.

Sample Input 1:

premium

Sample Output 1:

Verify your identity
Your premium account identification number: PA-01
Thank you for creating a new customer account!
You received 100 Gems

Sample Input 2:

standard

Sample Output 2:

Verify your identity
Your standard account identification number: ST-01
Thank you for creating a new customer account!
You received 50 Gems
Write a program in Java 17
import java.util.Scanner;

abstract class Customer {

public void createAccount() {
// write your code here ...
}

public abstract void generateCustomerID();

public abstract void sendGift();

public void verifyIdentity() {
System.out.println("Verify your identity");
}

public void sayThankYou() {
System.out.println("Thank you for creating a new customer account!");
}
}

class Premium {
// write your code here ...
}

class Standard {
// write your code here ...
}

//Do not change the code below
class Main {
public static void main(String[] args) {
final Scanner scanner = new Scanner(System.in);
final String type = scanner.nextLine();
scanner.close();
Customer customer = null;
___

Create a free account to access the full topic