import [Link].
*;
public class polymorphism {
String title,author;
int price,copies;
static int total=0;
void showtotalsales() {
[Link]("total sale of the publiccation is:"+total);
}
}
class book extends polymorphism{
private int copies;
public void getData()
{
Scanner sc=new Scanner([Link]);
[Link]("enter book details:");
[Link]("enter the title of thee book:");
title=[Link]();
[Link]("enter the author name:");
author=[Link]();
[Link]("enter the price of the book:");
price=[Link]();
[Link]("enter the number of copies:");
copies=[Link]();
}
void ordercopies() {
[Link]("number of copies order:"+copies);
}
void showtotalsales() {
int sale=price*copies;
[Link]("sale is:"+sale);
total+=sale;
}
}
class magzine extends polymorphism{
private int orderquantities;
private int currentIssues;
public void getData() {
Scanner sc=new Scanner([Link]);
[Link]("enter magzine details:");
[Link]("enter title of magzine:");
title=[Link]();
[Link]("enter order quantities:");
orderquantities=[Link]();
[Link]("enter current issues:");
currentIssues=[Link]();
[Link]("enter the price of magzine:");
price=[Link]();
}
void receiveIssue() {
[Link]("current issues:"+currentIssues);
}
void showtotalsales() {
int sale=price*orderquantities;
[Link]("sale is:"+sale);
total+=sale;
}
}
public class BookSub{
public static void main (String[]args) {
int ch;
Scanner sc=new Scanner([Link]);
do {
[Link]("enter the choice:");
[Link]("1:book");
[Link]("2:magzine");
[Link]("3:show total sales");
[Link]("4:exit");
ch=[Link]();
switch(ch) {
case 1:
Book1 b=new book1();
[Link]();
[Link]();
[Link]();
break;
case 2:
magzine m=new magzine();
[Link]();
[Link]();
[Link]();
break;
case 4:
[Link]("Exit");
break;
default:
[Link]("wrong choice");
break;
}
}while(ch!=4);
}}