需要返回类型??
出了一些错,想不明白,请帮忙看一下
interface ComputeTotalSales
{
public double totalSalesByYear();
}
class Television implements ComputeTotalSales
{
double a;
double Television(double a)
{
a=155555.22;
return a;
}
public double totalSalesByYear();
{
System.out.println("电视机的年销售额:%f"+a);
return 0;
}
}
class Computer implements ComputeTotalSales
{
double b;
double Computer(double b)
{
b=255555.22;
return b;
}
public double totalSalesByYear();
{
System.out.println("计算机的年销售额:%f"+b);
return 0;
}
}
class Mobile implements ComputeTotalSales
{
double c;
double Television(double c)
{
c=355555.22;
return c;
}
public double totalSalesByYear();
{
System.out.println("移动电话的年销售额:"+c);
return 0;
}
}
class Shop
{
ComputeTotalSales[] cts=new ComputeTotalSales[3];
cts[0]=new Television();
cts[1]=new Computer();
cts[2]=new Mobile();
double cts=0;
double sales(cts)
{
for(i=0;i<3;i++)
{
cts=cts+cts[i];
}
return cts;
System.out.println("总年销售额:%f"+cts);
}
}
public class Salesperyear
{
public static void main (String args[])
{
Shop shop=new Shop();
shop.sales();
}
}