Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need a Driver Class for the following code that matches the Example Runs output below. In JAVA please. import com.sun.tools.javac.Main; import java.util.List; abstract class Customer

Need a Driver Class for the following code that matches the "Example Runs" output below. In JAVA please.

import com.sun.tools.javac.Main; import java.util.List; abstract class Customer { private char letter; private int number; private static int nextA = 1; private static int nextB = 1; private static int nextC = 1; private static int nextD = 1; public Customer() { letter = 'X'; number = 0; } public Customer(char letter) { if (letter == 'A') { this.letter = 'A'; this.number = nextA; nextA++; } else if (letter == 'B') { this.letter = 'B'; this.number = nextB; nextB++; } else if (letter == 'C') { this.letter = 'C'; this.number = nextC; nextC++; } else if (letter == 'D') { this.letter = 'D'; this.number = nextD; nextD++; } else { this.letter = 'X'; this.number = 0; System.out.println("Error, letter must be A, B, C or D"); } } protected String getTicketNumber() { return letter + String.format("%02d", number); } public abstract String getCustomerInfo(); } class NewTest extends Customer { private String name; private String dateOfBirth; public NewTest(String name, String dateOfBirth) { super('A'); this.name = name; this.dateOfBirth = dateOfBirth; } @Override public String getCustomerInfo() { return "New Drivers License. Ticket Number " + getTicketNumber() + ". Name: " + name + " DOB: " + dateOfBirth; } } class Renew extends Customer { private String name; public Renew(String name) { super('B'); this.name = name; } @Override public String getCustomerInfo() { return "Renewal License. Ticket Number " + getTicketNumber() + ". Name: " + name; } } class Move extends Customer { private String name; private String previousState; public Move(String name, String previousState) { super('C'); this.name = name; this.previousState = previousState; } @Override public String getCustomerInfo() { return "Moved from " + previousState + ". Ticket Number " + getTicketNumber() + ". Name: " + name; } } class Suspended extends Customer { private String name; private String violation; public Suspended(String name, String violation) { super('D'); this.name = name; this.violation = violation; } @Override public String getCustomerInfo() { return "Violation: " + violation + ". Ticket Number " + getTicketNumber() + ". Name: " + name; } }

Example Runs: [User input in red]

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

1

What is your name? Conor

What is your date of birth? 09/09/03

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

1

What is your name? Sarah

What is your date of birth? 2/10/05

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

2

What is your name? Nick

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

3

What is your name? Paula

What state did you move from? MO

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

4

What is your name? Russ

What violation did you commit? DUI

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

1

What is your name? Jane

What is your date of birth? 01/01/65

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

5

New Drivers License.

Ticket Number: A1.

Name: Conor

DOB: 09/09/03

New Drivers License.

Ticket Number: A2.

Name: Sarah

DOB: 2/10/05

Renewal License.

Ticket Number: B1.

Name: Nick

Moved from MO.

Ticket Number: C1.

Name: Paula Violation:

DUI.

Ticket Number: D1.

Name: Russ

New Drivers License.

Ticket Number: A3.

Name: Jane DOB: 01/01/65

1. Take test for new license

2. Renew existing license

3. Move from out of state

4. Answer citation/suspended license

5. See current queue

6. Quit

6

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

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions