Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Follow the following instructions: (Feel free to add other components if/as required using your educated judgement.) 1. Create 2 interfaces: BankInterface and PetInterface. BankInterface contains

Follow the following instructions: (Feel free to add other components if/as required using your educated judgement.)

1.Create 2 interfaces: BankInterface and PetInterface.

BankInterface contains only 1 abstract method: accountType() which does not return anything and takes 1 String argument: accType.

PetInterface contains only 1 abstract method: petType() which does not return anything and takes 1 String argument petType.

2.Create an abstract class named Student. This class contains 2 instance variables, 1 constructor, and 2 abstract methods.

a.Instance variables: stId and stName (Use must use appropriate data type.)

b.A 2-argument constructor that will be called from its subclass (the concrete class) to load 2 instance variables of this level during the creation of an object in its subclass.

c.2 abstract methods: getStId and getStName.. Each of these methods, when sub classed into concrete ones, should return the respective values of the instance variables stId and stName.

d.At this level you should do something to get the object state at this level.

[25 marks]

3.create a concrete class named Centennial Student that makes use of the abstract class Student and the 2 interfaces: BankInterface and PetInterface. This class has two instance variables of its own, one constructor, and two methods of its own.

a.Instance variables: stDept and stTuitionFees. (Use appropriate data types.)

b.Constructor: one constructor that constructs a CentennialStudent object with all the centennialStudent information (stId, stName, stDept, and stTutionFees) supplied during the centennialStudent object creation.

c.Take necessary action to make this class a concrete class.

d.Take necessary action to get the complete string representation (i.e., the object state) of objects made from this class.

[35 marks]

4.Create a driver class named TestXXX (replace XXX by three letters of your name) that would ask for student Id, name, department, and tuition fees from the user and creates an object with the information entered. You ask also about the type of bank account the CentennialStrudent uses and also ask about his/her pet animal type. Use the implemented interface methods accountTpe and petType to display the values you entered. In order to accomplish this, you need to create variables at appropriate place to store the data entered by the user and use them in the implemented interfaces .You may use JOptionPane input dialog to get the input from the user and messageDialogs display the output.

[40 marks]

The interaction with input and output is shown below. If you chose to use JOptionPane dialogs, it will look different. For your screen shots, do not use the same data. Use your own data.

Please Enter your ID:

123

Please Enter Your Last Name:

Syed

Please Enter Your Department Code:

ICET

Please Enter Tuition Paid:

3000.00

What Type of Bank Account You Maintain?

Savings

Which Animal You Have as Your Pet?

Cat

Personal Info. You Entered Today:

Student ID: 123

Student Name: Syed

Student Dept: ICET

Student Tution Fees: 3000.00

You Have a:savings account.

Your Pet is a:cat.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Primary focus to be the Irish market, but with export potential.?

Answered: 1 week ago