₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,331,154 members, 8,448,894 topics. Date: Tuesday, 21 July 2026 at 03:05 AM

Toggle theme

Someone, Please Help Debug This Code - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingSomeone, Please Help Debug This Code (274 Views)

1 Reply

Someone, Please Help Debug This Code by lapo(op): 9:22pm On Mar 07, 2021
Hello all, please I can't pinpoint what I am getting wrong here. Someone help please.

public class Myclass{
public static void main(String [] args){
Inventory.trophy = new Inventory();
trophy.getlastbalance();
//Inventory.goldberg = new Inventory();


trophy.name = "trophy";
trophy.initialbalance = 20;
trophy.bought = 40;
trophy.sold = 10;
System.out.println("Stock of Trophy is "+ trophy.getlastbalance());

/*goldberg.initialbalance = 10;
goldberg.bought = 24;
goldberg.sold = 10;
System.out.println("Stock of Goldberg is "+ goldberg.getlastbalance());
*/
}
}

public class Inventory{
String name = "trophy";
int initialbalance;
int bought;
int sold;


public int getlastbalance(){
return (initialbalance + bought - sold);

//System.out.println("Stock of Trophy is "+ trophy.getlastbalance());
}


}
1 Reply

Someone, Please Help Debug This CodeCan Somebody Help Me Debug This?Debug This Code At Your Spare Time.234

Pls Use Me As Your Escrow In Port HarcourtLatest Project Renewed For Better ServiceI Need Someone Who Can Make A Good Pdf