Tarek_2 26 Light Poster

Hi,

  1. This algorithme will have a O(n) complexity : you will check all the tree, so the "binary" particularity doesn't change things.
  2. cout excutes :
    1+3+6+10+15+21+...
    Sum of (1+m)(m/2) and m changes from 1 to n
    To simplify, it will b a O(n³) (I think)
Tarek_2 26 Light Poster

Hi,
You must check your CSS selector here : img.resize means the tag img with the class name .resize somthing like :

<img src="/path/to/image" class="resize" />

Otherwise it won't work.

Check this course

Tarek_2 26 Light Poster

I will assume that this is your first try and you are new to this so let's start together :

StrongTEETH4U is a private dental clinic that is well known and has an excellent reputation in the area. All patients in the clinic have their details stored in a ClinicBook database. This database is used by the dentists and secretaries in the clinic to contact the patients for their routine checking and remind them of their appointment dates.

All this part is a simple description of the system, we can understand that there are patients and dentists. Let's see farther.

A patient has a patient number (a unique value), first name, surname, house/flat number, street, city, P.O. Box, telephone number, a first admission date to the clinic, the date of next appointment (if any!), and the dentist ID that has treated the patient.

Patient and his attributs, one Entity. A unique value means it's the primary key.

Patients have to register when they first attend by calling in to the clinic and provide a secretary with their details.

I don't see any additional data in this part.

Patients have to have appointments created for them by dentists and secretaries in the clinic before they can be seen or treated, and the date of the appointment along with the other required details is stored into the ClinicBook database.

Some tricky parts : is the appointment a Relationship or an Entity, it does not have a proper primary key, it …

Tarek_2 26 Light Poster

Good, very good. Now we will all our code inside the main method, but first : remove the lines 1, 2, 3 and 14.
Now lets assume that the gold worth is fixed, lets try some values then return to that point later.

So, lets be :

// double to get the maximum size and precision
double goldWorth = 30000;

Now, we need the calculation, but we can not write 2.5%, this % sign is the problem, so we must take the equivalent value of 0.025 :

double zakat = goldWorth * 0.025;

// Lets print to the screen
System.out.println(String.valueOf(zakat));

Try the previous code with different values of goldWorth.
Then we will proceed from there.

Tarek_2 26 Light Poster

Hi,

In this particular case, personally, I don't use any APIs, I simply generate a csv file which can be opened directy in Excel like any other Excel file.
CSV format is a text format wich means a simple FileWriter can be used without any external APIs.
The generation takes only one loop, the simpliest one whith a :

while(resultSet.next()){
        String line = resultSet.getXXX(1) + "\t" + resultSet.getXXX(2) + "\t" + ...;
        bufferedWriter.write(line);
        bufferedWriter.newLine();
 }

I will other answers about apache's API, I have never used it so I think I will learn something useful.

JamesCherrill commented: Excellent suggestion - keep it simple! +15
rproffitt commented: Cheap, Simple, and Valuable answer. +11
Tarek_2 26 Light Poster

Hi,

I don't think isValidateRoot() means what you think it means; I don't think you need it here. You have two JTextField, one for the inputs, the other for the result, so what's the problem? All buttons will use the same JTextField.

Tarek_2 26 Light Poster

Hi,

We can't do your homework, you will learn nothing.
But, some hints may help you ;

  1. It's evident that you need to use a loop inside another one :
    The first loop is to create many lines,
    The second one is to print many stars or dots.

  2. The second loop uses the first loop's index : the number of dots or stars per line is the number of the line itself (the first loop index).

  3. "Alternative" means "boolean" : use a boolean to change between dots and stars, the boolean changes its value in the end of the first loop.

Good Luck.

Tarek_2 26 Light Poster

To resolve this, you must use the try-catch differently : your methods must throw exceptions not catch them, and the try-catch bloc will be in the enterJButtonActionPerformed method.

A simple tutorial here

Tarek_2 26 Light Poster

Hi,

I agree with Ewald, but if you search a simple solution (if there is no message to passe from the first applet to the second) you can make a simple redirection to the html page wich contains the second applet. In this solution, you will have two web pages, each page contains one applet. To realize the redirection, you can use :

getAppletContext().showDocument()

A simple example is given here :

Click Here

Good Luck

Ewald Horn commented: Nice idea. +3
Tarek_2 26 Light Poster

Hi,

To not complicate things and to avoid adding an if..else you can try to stop the loop before the end of the array :

    for(int i=0 ; i < myArray.length - 1 ; i++){
        System.out.print(myArray[i]+",");
    }

Then, write the last element :

    System.out.print(myArray[myArray.length - 1]);