stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I need a complete source code of ONLINE EXAMINATION SYSTEM in JSP+ORACLE. Can sombody help me?
my e-mail id : ----

Why do you want to cheat your way out of these projects ?? These assignments are to help you learn and understand and get a taste of programming, a scaled down version of something which you might encounter in the real world when you finish your course and enter the world of development.
We will help you but only if you are going to be developing this assignment on your own rather than opt for plagiarism.

Also here is a pointer to the rules which you have conveniently forgotten to read.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
final char grade;

Declaring a variable as "final" is almost like making it a constant and hence its value cannot be changed later (which you are doing in the "if else" blocks.

I guess I was wrong on that call, I had the opinion that you need to specify the value for the "final" variables during declaration itself, but when I compiled and ran the code I got the output:-

stephen@steve:~/Development/java/daniweb> java Grade 61
The grade is D.
stephen@steve:~/Development/java/daniweb>

So I guess the only problem is as stultuske suggested, you are not specifying the command line argument of marks correctly.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
final char grade;

Declaring a variable as "final" is almost like making it a constant and hence its value cannot be changed later (which you are doing in the "if else" blocks.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Try the Open Office Java API. I recollect Ezzaral suggesting it to another poster earlier.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

We are definitely thinking about the new tough questions so it seems that way.

is it true that all work and no play would make Jack a dull boy ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

That depends, what are you working on right now, what type of application is it ? A web page, Swing form ? You want specific answers but you haven't yet given details specific to your application.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Either you generate the Id and assign it to the user yourself using an autoincrement or a UUID feature, but if you want the user to select his own ID you will have to perform a check in your records (database or files) to check if the ID has already been chosen by someone else.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I wish I knew that answer, but glad I don't.

Is the next person who posts here "bald" ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Can you also attach a snapshot of the screen you got.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
INFO main org.apache.catalina.core.StandardEngine - Starting Servlet Engine: Apache Tomcat/5.5.26

One more thing I forgot to mention last time out. If this is a Linux Server I have a **feeling** that your ISP was using the Tomcat which was acquired in that O.S's software repository, These versions are by default configured to use "gcj"(which is I **suppose** compliant with only JDK 1.4.2 specs) and not the Sun JDK/JRE, So you also might want to ensure that they have an appropriate version of the JRE installed.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

@transplantedNYr

If you are just begining Java as it appears to be, just like verruckt I suggest you use a minimalistic IDE, With Eclipse just as you noticed now by asking about the compile button, you will get lost trying to figure your way around. Use a minimalistic IDE without autocomplete may be even just a text editor like Notepad, just as verruckt says you will understand the process what these IDEs do in the background and thus will make it easier for you to understand where to find what when you are actually working on large scale projects using an advanced IDE like Eclipse or Netbeans.

I personally prefer Eclipse for my projects but for beginners I always recommend lighter IDEs like JCreator LE (which is a freeware), BlueJ.

Knowing what happens in the background is always important because then you become free of your IDE and can change as needed, Using an IDE like Eclipse from the start will just force one mindset one way of thinking (on the way sources are organized, projects are created etc) that you will find switching over to other IDEs like Netbeans or IntelliJ very difficult.

I believe by default Eclipse is configured to automatically compile the java code when you run it.

Eclipse by default is configured to compile your code every time you save it. Unless you have manually disabled the "Build Automatically" option in the "Project" menu. If that is disabled …

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

This is more of a core java question, So it should have been posted in the Java forum.
Anyways take a look at the javadocs of the String and StringBuffer class you might find what you are looking for there, most probably it is the substring (1,2) menthod..

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
System.out.print((18000/m) * p);

This is what caused the divide by zero problem. If you trace back correctly the value of "m" at the start of the loop ( for (int m = 0; m <= milesPerGallon.length; m++) ) is "0" and as per that formula you are dividing by zero on the first iteration.

Also you seem to have missed the concept of using arrays here.
In the following formula (18000/m) * p , we do not want the value of "m" nor "p", we want the value at index "m" in the milesPerGallon array and the value at index "p" in the pricePerGallon array respectively. That is the formula would become :-

System.out.print((18000/milesPerGallon[m]) * pricePerGallon[p]);

And to print the table correctly in your original code you will need to chuck out this section at the start:-

for (int m = 0; m <= 8; m++)
  System.out.println(milesPerGallon[m] + "\t\t");
}

This will cause the milesPerGallon to be printed on separate lines with just empty values, kind of like :-

MPG 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25
-------------------------------------------------------------------
5
10
15
20
25 
30
35
40
45
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The second option is you could try figuring out how they send the request from the page where you specify the currency details and parse whatever response you get back to check for the conversion details.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I haven't seen them yet.

yes and it is also future's past.

oops you said a forbidden word.


Can the next guy avoid it ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Like it

Lazying around ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

First of all you will need an API (provided by one of various currency exchange websites) which will feed you the data if you want live /real time exchange rates.
I normally use www.xe.com to check currency rates, they also have their own data feed product where they will post you their data in XML,CSV or just in a plain old HTML table, however you need to pay for it and I do not **think** that any of these sites will let you use this service for free (Of course I could be wrong).

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You will need to move this declaration inside the main.

double[][] annualCost = new double[10][8];

<EDIT>
In fact you can remove it altogether because the only reason you are not getting any errors because of it is due to the fact that you are never using it in your main.
</EDIT>

Now by this p < pricePerGallon , I am guessing you meant p < pricePerGallon.length ,

Also by for (int m = 0; m <= 45; m++) , you will need to change that to for (int m = 0; m <=milesPerGallon.length ; m++) else you will get the array index out of bounds exception, because the size of your
milesPerGallon array is only 9, whereas the for loop would run from m=0 to m=45, and when "m" crosses the value of 8 you will get the array index out of bounds exception as your array "milesPerGallon" has only 9 indexes or elements indexed from 0 to 8.
And just for your info whenever you call <ArrayName>.length, it gives you the size of the array.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

This is a HTML question rather than a JSP question and all you need to do is wrap the <img> tags inside the anchor element (<a> tags).

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Tomcat by default doesn't have support for JSF (amd definitely Tomcat 5.5 doesn't),
Are you sure the new place has the JSF libraries because the following suggests the JSF libraries are mssing.

java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener

Also have never seen as yet anyone use JSF with a Tomcat version prior to 6.0.

peter_budo commented: Good tip +14
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Like it

Nightmares ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well to calculate days I would prefer a more simpler method like this :-

// Current day would store the index of the day in the Array
// 0 points to Sunday.

int currentDay = 0 
String days = {"Sun", "Mon", "Tue", "Wed", "Thr",  "Fri", "Sat" };

// Now if you want the day 10 days 
// after current day just do

String afterNextTenDays = days[(currentDay + 10) % 7];

String nextDay =  days[(currentDay + 1) % 7];

Similarly you can go on for all your combinations.
Also it is not exactly foolproof, you will need to take into account the special case when the currentDay is Sunday (and so set to 0) and the User asks for the previous day. In that case the formula in the square bracket would become [(7-(currentDay - noOfDays)%7)%7], this formula would be needed whenever you want to calculate a previous day. Looks kind off complicated but I guess there should be an easier way.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

My suggestion for your Line equation class is, do not store it directly as :-
y = m(x-x1) + y1

Instead store it in a reduced format as
y = mx + c
or
mx - y = - c --> Preferred as you will see in the last point.

And as you can see c = (y1-mx1), and ensure that you reduce all common factors, that is if you have an equation as 2x+2y = 2, reduce it to x + y = 1 , so that whenever you have to use the equations either to solve them simultaneously or to just to compare them, you can do so directly without any extra processing.

Also I think you might be interested in how to solve linear equations simultaneously using the determinant method as that is an easier option to program in your code.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

My suggestion would be use another Array for storing your "pricePerGallon".
Like this:-

double pricePerGallon[] = { 1.50, 1.75, 2.00, 2.25, 2.50, 2.75 };

Then you will need to modify your "for" loop and add another nested for loop inside to perform the calculations and print the results for each line in this manner:-

for (int i = 0; i <= 45; i++) {
  System.out.print(milesPerGallon[i] + "\t\t");
  for(int j=0;j<pricePerGallon;j++) {
    // Perform your calculations here using the corresponding 
    // values from milesPerGallon and pricePerGallon arrays.
   
  }
  // We will want to go to the new line after printing 
  // the calculations of the current milesPerGallon value
  System.out.println();
}
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

No problemo.
Best of Luck in converting that to code.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well I see that you have specified a line segment to have two end points.
Now to check if lines are collinear you will have to get their equations and solve them simultaneously.
Now the equation of a line with slope "m" and with point (x1,y1) on it is given by :-
y = m(x-x1) + y1
You will need to define data members in your LineSegment class to store this information.
Once you have got the equations for all your line segments, to figure out if they are collinear or just intersecting you will have to solve the equation of any two of the line simultaneously.
For example consider we have three lines with the equations:-

Line 1: 3x + 4y = 3
Line 2: 2x - 2y = 7
Line 3: 9x -y = 0

You will need to solve any two of the equations simultaneously, to find the intersection points of the lines. That is if you solve the equations of Line 2 and Line 3 simultaneously you will get the intersection point of Line 2 and Line 3.
Next if you solve the equation of Line 1 and Line 3 simultaneously you will get the intersection point of Line 1 and Line 3.

If the intersection points in both the cases (Line 2 & 3 and Line 1 & 3) are both the same, then it means that the three lines are collinear and …

oldSoftDev commented: Awesome explanation +2
verruckt24 commented: That's a good bit of work in there. I thought of anwering this, but then couldn't find the time recollecting facts about lines. Keep it up. +2
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Honestly there isn't enough information to suggest anything other than wild guesses.
Can you tell us the structure of your Point class, Line class etc, so that would help us see the problem from your perspective.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

leak

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

-1125

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Pan Map Man

prince

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Ok then lets make it a series,

But how many people want to play again ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

There should be we just have to find it.

Have you found such a question ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

HTI

life ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Now I am going to make some assumptions here on your merge method, My main assumption is if your method is called as arr2.merge( arr1 , arr); then you want the contents of arr1 and arr merged and in sorted order inside arr2.

Now if thats the case, why don't you parse the contents of "arr1" and "arr" separately and insert them into arr3 by calling arr3's insert() method, and as long as you are sure your insert method works fine, so will the merge method.

What I meant was something like this:-

public  void merge(OrdArray arr, OrdArray arr1)  {
  for(int i=0;i<arr.nElems<i++) {
    insert(arr.a[i]);
  }
 // Repeat similarly for the next object arr1
. .
. .
}

So as long as your insert() method works fine, your merge() method should not have issues.
Also a suggestion is refer to Sun Java Code Conventions, at least more important parts related to conventions for indenting and naming variables and methods.

Also you need to improve your skills in Object Oriented Programming, since in the program you are violating the principle of Encapsulation by making your member variables public. Your member variables should be private and in case you need to access them inside a different class implement the appropriate getter and setter methods that control access to these variables in an organized manner.

notuserfriendly commented: Very nice and simple implementation +3
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Start your own thread if you are facing any issues do not simply revive ancient relics.

Next there is also a separate forum for JSP in the Web Development Section, you should have made a thread there.

Also define what you mean by "NOT-WORKING" and "WORKING WELL". Check the logs of catalina.out to see if anything is being logged there. Also did you check the link already posted by "aniseed" as a response to the thread starter ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

It was, but now the excitement is slowly running out.


is it forbidden to say the forbidden words ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Are you using httpd or are you using Tomcat ?
AFAIK httpd doesn't support JSPs it supports CGI and PHP technologies.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

on ton no

settler

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Are you designing your own forum ?
Although I do not know whether it may be relevant to this thread, but then maybe you can check out some open source third party forum software available, for ex:- JForum (A Free and Open Source Java based forum engine).

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

fare deaf field

dear

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Love it.

Pizza ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster
displayTextField.setText("3")

Now when a user dials a number I guess you might want to display the entire number to the user.
The way you are using setText() it would actually erase whatever is present in the Text Field with whatever value you set. If you want to display the entire number I replacing the above piece of code wherever it appears with:-

displayTextField.setText(displayTextField.getText() + "3");

The above piece of code will get whatever value is present in your TextField and append there to it, and set it as the new value in your text field. You will need to do the same for all your other numbers.
And when the user presses "SEND" store whatever value you have received for that Number in a variable for accessing it later and then prefix "Calling " to whatever you have in your text field like for ex:-

displayTextField.setText("Calling " + displayTextField.getText());

Similarly if say you have stored the original number in a variable called "number", if the user presses redial instead of prefixing "Calling " in the above statement use "Redialing " + number , when the "Redial" button is clicked

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Can you tell us what problem are you facing and where is your program going wrong ??

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You should skip this. You already have enough to worry about, and spending mental energy worrying about 11 chapters of arbitrary rules at this stage is a form of insanity. You will pick up awareness of standard practices by writing Java code and reading others' code.

Wow !! Directly contradicting someone elses suggestion without actually adding anything useful. I do not want to be hostile here but I did not ask the O.P to do a Ph.D on it, I only asked him to go through it. Also following some simple uniform conventions for variable naming and indentations etc help reduce silly mistakes which beginners are more susceptible to.
And the most important part is he is learning to program then he might as well learn some good things along the way rather than just skip all the good pratices which these programs are supposed in grain in him so that he doesn't fall part when he actually has to make something more important than a home work assignment.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Now I would like you to also go through the Sun Coding Conventions for Java so that you can name your classes and methods appropriately.
Also if you are just learning Java the Sticky "Starting Java" has linked to quite a few excellent resources.

Now the price per gallon list you could have stored it using Array. Like this :-

double pricePerGallon[] = { 1.50, 1.75, 2.00, 2.25, 2.50, 2.75 };

Go through this tutorial on arrays which I had already linked to in the previous post.
Also Take a look at the Object Oriented Programming Tutorial I had linked to earlier and also this one I picked from the sticky.
Because Java is best used as an Object Oriented Programming Language and the earlier you start developing your thinking in Object Oriented terms the more easier you will find it later to design your programs / applications using OOP.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Mad as in ... Mad about Coding ... etc ??

So is the Sky Blue ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Now the next logical step would be you want to validate the user.
What you could do is store a username and a password in either a File or a table in a database for ex: MS Access (or Apache Derby which ships with the JDK I assume.)

And whenever anyone clicks on say the "Login" or "Submit" button you would have to first validate whether the user has actually entered a value in the Password and UserName fields (if not you could show him an error message using the dialog boxes of JOptionPane) but if a proper value is found in both the fields you validate the user against the values (for username and password) present in the File or the database.
If the username and password combination specified in the form fields matches what you have in the File (or a the database table), you could display a success message (using JOptionPane once again) and stop there itself or take him a new form where you might want to do some more processing.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Now when I see this line, I observe two problems :-

System.out.print(annualCost.format(mpg[m][cost]));

Now when I see this line, I observe two problems :-


  • There is no such as "annualCost" object declared or initialized in the main, and you are trying to call the method format(int) on it.
  • If you are trying to call annualCost() method then you have got it all wrong.
  • mpg[m][cost] :- Now you have no array called as mpg, it is just an int, which gives an indication that you haven't grasped the basic concepts of Java yet.

Just As The "Slammander Man" said reading the code (and might I add understanding the purpose of each) character by character would have easily fixed the problem and made you a whole lot wiser on the debugging front.
Also I would suggest going through a few tutorials like this and this to get a firm grasp on the basics of Java.