how to convert a c programming to java programming
russellwhitaker at my-deja.com
russellwhitaker at my-deja.com
Wed Aug 23 19:52:32 EDT 2000
In article <8o04ss$tr9$1 at nnrp1.deja.com>,
yiqi at my-deja.com wrote:
> hi,
>
> currently, i was given an assignment to create a program using java
> language. my assignment topic is matrix multiplier, and the program
> should be in java applet. but, i have written out the program in c
> language. as i am not familiar wif java languange, i found a great
> difficulty in converting the language in java. i reli hope u all can
> help me to solve this problem. thanks.
> below is the c language of matrix multiplier application as a
> reference to u all
[CODE SNIPPED]
Couple of things:
- You're posting to a Python newsgroup, not a Java newsgroup. Try
comp.lang.java , if there's a strict requirement to do this in Java.
- Curiosity compels me to ask, however: what type of class is this assignment
for? Is this a "Programming in Java" class? If so, you might re-read your
question and note that it _seems_ from its unqualified generality that you're
asking others to do your homework for you.
Now, I doubt you're asking others to do your homework for you. Assuming I'm
correct then, please clarify this one critical issue: is one of the
requirements of your assignment that you reimplement an existing C
implementation of a matrix multiplier in Java, or may you use any other
language? If the latter, Armin's advice (use JPython to compile a Python
implementation down to Java bytecode, then run as a "Java applet") satisfies
the letter of the law.
I would also suggest that you simply not _read_ the reference C
implementation. This is a learning exercise, right? You'll get much more
learning out of this exercise by: - getting an explicit problem statement
from your instructor, in detail - getting explicit programming guidelines
(choice of language, etc.) - getting the algorithm for a matrix
multiplication (this is language independent) - implementing the algorithm
from scratch in your target language, *without confusing the issue by trying
to reverse engineer an existing implementation written in another language*
That last point above is crucial. The way you solve this problem in Python
is different from the way you solve it in C. Hint: use Python's built in
'list' datatype. Big hint: use nested 2-element lists or tuples. You'll write
less code.
Again, if you get the instructor to strictly
agree that you can do this as a "Java applet", regardless of the language
the bytecode is compiled from, you can use Python to do this very quickly
and easily.
Good luck,
Russell
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list