darkagn 315 Veteran Poster Featured Poster

Hi and wecome fellow Aussie! (We are slowly taking over Daniweb) <insert evil laughter> :D

jbennet commented: rep time +22
darkagn 315 Veteran Poster Featured Poster

It looks to me like it is a flag to tell whether something has been inputted or not. If it hasn't, isFixReg is set to true, and pressing a number (for example) starts a new String. Otherwise, isFixReg is false and entering a number will add to the existing text.

It might pay to check this with T.Yamazaki via the email address that is provided, but since the code was written over 11 years ago you may not get a response from that address.

As an aside, this is why it is important to provide meaningful names and/or comments for methods, variables, classes etc. Just because the author of the code knows what it means doesn't mean that they will always be responsible for maintenance of the code.

Jishnu commented: Nice post :) +2
darkagn 315 Veteran Poster Featured Poster

Ok I don't want to give it away, but the line

String "type";

is not how you initialise a String. And it is in the wrong method.

You have moved the line

Triangle T = new Triangle();

from where it should be to the wrong place. I sugeested earlier that you need to modify this line, not move it.

darkagn 315 Veteran Poster Featured Poster

I like the solved threads count. But maybe as a compromise the moderators/administrators of daniweb could have this info removed from their profiles? After all, they are moderators so we all know how good they are ;)

~s.o.s~ commented: Saves us all the embarrassment, eh? ;-) +20
darkagn 315 Veteran Poster Featured Poster

Hi piers,

The problem is that you posted a huge chunk of code that any of your fellow students could copy easily by searching for "scanner" in google. I think that is what the person is implying (possibly one of your professors?) Next time maybe just post the relevant code?

darkagn 315 Veteran Poster Featured Poster
int create_pascals(int a, int b)
{
/*
This section of the code is checking to make sure that the two parameters passed into the function are non-negative and that a is larger than b. Otherwise we exit straight away.
*/
	int cons = 1, row;
	if (a< 0|| b<0|| b>a)
	{
		cout << " error!!! the program will now terminate." << endl;
		exit(1);
	}

	else
	{
/*
This section of code is doing the calculation for what the method is calculating. By the looks of it, the second parameter passed into the function tells the method how many rows are in the pascal and the first parameter passed in tells it how long each row is.
*/
	for (row=1; row<=b;row++, a--)
	{
		cons = cons*a/row;
	}
	return cons;
	}

}

Hope this has helped,

darkagn

ithelp commented: good explanation. ithelp +2
darkagn 315 Veteran Poster Featured Poster

I received the following email the other day and thought it was worth sharing. I chuckled but maybe it's just my stupid sense of humour... :twisted:

-----------------------------------------------------------------------------------------------


Are you male or female?


Look down...

I said look down not scroll down!!!

Ancient Dragon commented: Very true! +20
darkagn 315 Veteran Poster Featured Poster

Hi Libran,

To help debug your code, try adding some println statements to gain a better understanding of what is going on. Please see my comments below.

import java.util.*;
import java.io.*;
public class FranchiseManagementSystem
{
    private BufferedReader br;
    private String[] str;

    public FranchiseManagementSystem() throws Exception
    {
        br = new BufferedReader(new FileReader("applicants.txt"));
        str = new String[50];
        readApplicantDetails();
    }

    private void readApplicantDetails() throws Exception
    {
        String thisLine = "";
        int i = 0;
        while ((thisLine = br.readLine()) != null)
        {
            [COLOR="Red"]System.out.println(thisLine);
            System.out.println(i);[/COLOR]
            str[i] = thisLine;
            [COLOR="Red"]System.out.println(str[i]);[/COLOR]
            i++;
        }

        if (str.length < 5)
        {
            [COLOR="Red"]System.out.println("str.length < 5");
            // str.length must be at least 5 since the following println statement fails to execute[/COLOR]
            System.out.println("Applicant entries are less than the minimum required number.");
        }
        else
        {
            for (i=0; i<str.length; i++)
                System.out.println(str[i]);
        }
    }  

}

Hopefully these println statements will help you debug your program. Don't forget to comment them all out for your final program! ;)

iamthwee commented: Good simple advice! +11