interface
interface
The Interface defines a rule that any classes that implement it should override all
the methods. Let's implement Interface in our application. We'll start simple, by
including display method in the Stall interface. Now all types of stalls that
implement the interface should override the method.
Method
Description
void display()
abstract method.
Create a class GoldStall which implements Stall interface with the following
private attributes
Attribute
Datatype
stallName
String
cost
Integer
ownerName
String
tvSet
Integer
Method
Description
void display()
To display the stall name, cost of the stall, owner name and the number of tv sets.
Create a class PremiumStall which implements Stall interface with following private
attributes
Attribute
Datatype
stallName
String
cost
Integer
ownerName
String
projector
Integer
Method
Description
void display()
To display the stall name, cost of the stall, owner name and the number of
projectors.
Attribute
Datatype
stallName
String
cost
Integer
ownerName
String
screen
Integer
Method
Description
void display()
To display the stall name, cost of the stall, owner name and the number of screens.
Input Format:
The first input corresponds to choose the stall type.
The next line of input corresponds to the details of the stall in CSV format
according to the stall type.
Output Format:
Print “Invalid Stall Type” if the user has chosen the stall type other than the
given type
Otherwise, display the details of the stall.
Refer to sample output for formatting specifications.
Note: All Texts in bold corresponds to the input and rest are output
ChooseStall Type
1)Gold Stall
2)Premium Stall
3)Executive Stall
2
Enter Stall details in comma separated(Stall Name,Stall Cost,Owner Name,Number of
Projectors)
Knitting plaza,300000,Zain,20
Stall Name:Knitting plaza
Cost:300000.Rs
Owner Name:Zain
Number of Projectors:20
ChooseStall Type
1)Gold Stall
2)Premium Stall
3)Executive Stall
3
Enter Stall details in comma separated(Stall Name,Stall Cost,Owner Name,Number of
Screens)
Fruits Hunt,10000,Uber,7
Stall Name:Fruits Hunt
Cost:10000.Rs
Owner Name:Uber
Number of Screens:7
ChooseStall Type
1)Gold Stall
2)Premium Stall
3)Executive Stall
4
Invalid Stall Type