void showChannel()
{ if(status==1)
System.out.println(channel);
}
}
class User
{
public static void main(String arg[])
{
Television tele1=new Television();
Television tele2=new Television();
tele1.power();
tele1.increaseChannel();
tele1.showChannel();
tele2.power();
tele2.increaseChannel();
tele2.showChannel();
}
}
A factory manufactures 14 inches television sets. A television
produced by this factory has the following buttons on it.
Power button
Channel Increase Button
Channel Decrease Button
Volume Increase Button
Volume Decrease Button
A Show Channel Button to display the current channel number
A Show Volume Button to display the current volume status.
Model above factory with the help of a class Television. Represent
on/off,volume and channel circuits with data members of type int.
Circuits can not be accessed directly by the users(all private).
All buttons should be represnted with the help of public functions.
also add a constructor to initialize all the data members to 0.
Creat two objects of this class type(purchase the television set from
this factory), push the power button of one television , increase its
channel and then push the show channel button to see the current
channel number.
Repeat these steps for second television.
Also try to display the size of a television in main().
class Television
{
int status;
int volume;
int channel;
public int size;