Hi i need some help with an assignment. There are 3 files(below) and i need to translate the pseudo files into java and get the following output:Name is currentlyName has been changed to PicoInserting Pico into table Cat1ST FILE:include Catcat = new Cat()println "Name is currently " + cat.namecat.setName("Pico")println "Name has been changed to " + cat.namedata = new Data("database")data.insert("Cat", cat);2ND FILE:class Cat { attribute name attribute age attribute favoriteFood method constructor { name = nil age = nil favoriteFood = nil } method getName { return name } method getAge { return age } method getFavoriteFood { return FavoriteFood } method setName (newName) { name = newName } method setAge (newAge) { age = newAge } method setFavoriteFood (newFavoriteFood) { FavoriteFood = newFavoriteFood }}3RD FILE:class Data { attribute db method constructor (database) { db = connect(database) } method beginTran { println "Beginning a transaction" return db.begin } method commit { println "Committing transaction" return db.commit } method rollback { println "Rolling back transaction" return db.rollback } method insert (table, object) { println "Inserting " + object.getName() + " into table " + table return db.insert }}
HiWelcome to JustAnswerCould you elaborate a little more?
HiOn which topic would you like me to elaborate?
What exactly you are trying to do?If you have any file(s). Zip, upload the file to http://wikisend.com and post download link here. Formatting is messed up.
What im trying to do is "Translate" those 3 pseudo files INTO java / jdbc so i can get the output:Name is currentlyName has been changed to PicoInserting Pico into table CatThats all i want to do for now.Heres the wikisend link with them inside:http://wikisend.com/download/518260/Todo.rar
Do you have any guidelines about database?Which database you need to you?Do you have any table structure?
I have installed and use MySQL i havent been given a table structure so i guess i have to create it myself.
Can we use MS-Access?It will be lot easier and you can use same queries.Connecting to MySql is itself a project if you don't know database programming
Nope unfortunately i have to use Java. I do know database programming, its just that while i am trying to create the 3rd file, in the insert statement im having difficulties creating the method for it.
I meant Java with MS-Access. let me know
"Choose to work in Java on the operating system of your choice"
Those are the instructions that i got. But im almost certain because there are some extra tasks to do after i complete the "translation" that this thing has to be done in a database SQL preferably.
Whic IDE are you using?Are you on windows?I am trying to figure out if we can use MS access with Java?it is easier as we won't be adding additional jar used to create connection to MySql and putting it on classpath
Im using Eclipse:Indigo ReleaseOperating system: WindowsI have already downloaded and added "MySQL JDBC Driver" on the build path of my project on Eclipse. I have created a test class to find the version of it for example and it works perfectly.
Great.Create a database and a table in that database to store the name.Then let me know the name of databse and table structure.I will create same table here in same database and write the code
the database name is:newdatabase and table: animalsi did: create table newdatabase.animals (name varchar(20) not null);
Ok. Please wait for 30 minues while I write the code for you
ok thanks i will wait
ok :)
Hey sorry if i interrupt, how is the code going? :)
Almost done. please wait
Ok thanks alot for everything, can i ask you to save your work that you have done for me in case i need more help on the project? i have more stuff to do on it but i ll try to do it by myself :)
ok, I will save it.