storing and retrieving a java method in MySQL

I am a high school math teacher. I'd like to use computers to ask incoming students a series of math questions to test their readiness for a class that I teach.Is it possible to store and retrieve a mathematical expression in a MySQL database such that it can be recalled and used to evaluate a student's response to the question? If so can you point me to some reading and suggest a solution. By the way, my programming skills are not very advanced.

I can imagine using the program to do standardized testing where the question bank could become large > 1000 questions, each with an expression that must be evaluated to score a student's answer as correct or incorrect.

[697 byte] By [nmtestgeeka] at [2007-11-27 7:43:20]
# 1

> Is it possible to store and retrieve a

> mathematical expression in a MySQL database such that

> it can be recalled and used to evaluate a student's

> response to the question?

Do you just want to display it or do you actually want to calculate with it.

The first is just store it.

The second requires dynamic code execution. The following come to mind

- Store a java class in the database. This requires using a custom class loader

- Use Beanshell

- Use the built in equivalent to Beanshell that is is java 1.6.

> If so can you point me

> to some reading and suggest a solution. By the way,

> my programming skills are not very advanced.

All of the solutions are going to require more that a bit of work.

>

> I can imagine using the program to do standardized

> testing where the question bank could become large >

> 1000 questions, each with an expression that must be

> evaluated to score a student's answer as correct or

> incorrect.

Why does it need to be an equation?

Why does it need to be stored in the database? For example the database could just hold a class name which has a single method that evaluates a equation (not that parameter passing is still a complication that all solutions would require.)

jschella at 2007-7-12 19:24:08 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Thanks for your reply jschell.

I don't suppose that it must be an equation in fact I'd prefer to store a string that describes the mathematical means of arriving at the correct answer, if that were possible. Suppose that this question is asked:

A right triangle has legs that measure 3 meters and 4 meters. What is the length of the hypotenuse?

Student answers with the number 5 and selects meters from a pull down list.

I want to store the following expression in a database so that it can be retrieved to check the student's answer.

answer = ( int)(Math.sqrt((var1 * var1) + (var2 * var2)));

"Why in a database?" So that text, variables, images, difficulty levels, and etc can be indexed for easy storage, retrieval, and maintenance.

Any ideas on a simple way to make this work?

nmtestgeeka at 2007-7-12 19:24:08 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

If you want to take this on yourself in Java I believe there are many people in the forum including myself that would be happy to help an educator. If it were me, I might look to a pre-packaged solution to help minimize the amount of time you have to spend in both the initial build of the application and the constant updating that is often required for these types of applications.

Have you had a chance to look at any of the pre-packaged (non programming) solutions from Wolfram Research? There may be less expensive solutions; this is just one that I have personal experience with.

Wolfram provides a nice framework based on the industry standard Mathematica. I am not associated in any way with Wolfram, but I have used Wolfram software on a personal / non-paying project building a special education curriculum for H.S. kids with Non Verbal Learning Disorder (NLD): You can view information on Wolfram software for the classroom here.

http://www.wolfram.com/products/classroom/

WorkForFooda at 2007-7-12 19:24:08 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

> Thanks for your reply jschell.

> I don't suppose that it must be an equation in fact

> I'd prefer to store a string that describes the

> mathematical means of arriving at the correct answer,

> if that were possible. Suppose that this question is

> asked:

>

> A right triangle has legs that measure 3 meters and 4

> meters. What is the length of the hypotenuse?

>

> Student answers with the number 5 and selects meters

> from a pull down list.

>

> I want to store the following expression in a

> database so that it can be retrieved to check the

> student's answer.

>

> answer = ( int)(Math.sqrt((var1 * var1) + (var2 *

> var2)));

Why not just store "5"? Or "Answer 3" (third item in the list that the student picked)?

>

> "Why in a database?" So that text, variables, images,

> difficulty levels, and etc can be indexed for easy

> storage, retrieval, and maintenance.

>

Why does the equation itself need to be stored in the database?

For example if you put the equation in a java class like...

package com.anywhere.Test2;

class Question22

{

public int Calc(int var1, int var2)

{

return ( int)(Math.sqrt((var1 * var1) + (var2 * var2)));

}

}

Then you put the following text in the database

"com.anywhere.Test2.Question22"

The test code then uses that text to load the above java class file.

> Any ideas on a simple way to make this work?

I am rather certain that there are no simple ways.

jschella at 2007-7-12 19:24:08 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...