I was working on a project, and was experimenting on integer declarations.
Notice that I have the number of
public class Project extends Base implements Colors
private int redCars=0;
super(h, y, 5, 0);
public void test()
redCars, which is a derivative of
blackCars, the private variable located in the imported file. The imported file has made the specific integer private itself and cannot be declared in this class alone. My goal is to get the number of remaining black cars without declaring blackCars from the imported file. The important thing to know is that there are 50
blackCars, three of which are declared as
redCars++. So, I would like to insert a function that would declare the remaining number of blackCars without putting an exact value, as I will need it as a model to be used for a repeated number of times.
TO put it in a different way, this is a translation of what I would try to do:
Of course, that will not work since I can't add an operator to the data-type alone. Moreover, one possible alternative is just to declare all
blackCars, then use a for-statement by counting the
redCars, therefore highlighting the remaining value?
*There may be a glitch or bug in this post.
[IMG]http://www.codingforums.com/data:image/gif,GIF89a%12%00%12%00%B3%00%00%FF%FF%FF%F7%F7%EF%CC%CC%CC%BD%BE%BD%99%99%99ZYZRUR%00%00%00%FE%01%02 %00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%04%14%00%FF%00%2C%00%00%00%00 %12%00%12%00%00%04X0%C8I%2B%1D8%EB%3D%E4%00%60(%8A%85%17%0AG*%8C%40%19%7C%00J%08%C4%B1%92%26z%C76%FE %02%07%C2%89v%F0%7Dz%C3b%C8u%14%82V5%23o%A7%13%19L%BCY-%25%7D%A6l%DF%D0%F5%C7%02%85%5B%D82%90%CBT%87%D8i7%88Y%A8%DB%EFx%8B%DE%12%01%00%3B[/IMG]