gunjannigam 28 Junior Poster

Where is the sale and purchase of Inventory happening ?

gunjannigam 28 Junior Poster

hi
I have a problem regarding calling print() method through main().It asks to pass arguments but i already done so using constructors.Any help in missing statement.

public class ElectricityBill {
	public static void main(String args[]){
    current c1=new current(500,"January");
    current c2=new current(1600,"February");
    
    c1.print(double total,String month);//this is the place i wanna know,how to call print()
    
    
	}
}

class current{
	int usage;
	String month;
	double total;
	
	current(int u,String m){
		usage = u;
		month=m;
	}
	double calculate(int usage){
		double u1=12.50;
		total=usage*u1;
		return total;
	}
	void print(double total,String month){
		System.out.println("Your bill for month "+month+" is "+total);
	}
}

Declare and Initialize total and month that you are passing as argument.

double total=500;
String month = "January";
c1.print(total,month);