How JustAnswer Works:

 
 
 
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
 
 
 
Ask LogicPro Your Own Question
LogicPro, Computer Software Engineer
Category: Programming
Positive Feedback: 99.4 %
Satisfied Customers: 7422
Experience: Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
Type Your Programming Question Here...
LogicPro is online now
A new question is answered every 9 seconds

Hi i need some help with an assignment. There are 3 files(below)

Resolved Question:

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 currently
Name has been changed to Pico
Inserting Pico into table Cat

1ST FILE:

include Cat

cat = new Cat()

println "Name is currently " + cat.name

cat.setName("Pico")

println "Name has been changed to " + cat.name

data = 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
}
}

Submitted: 11 months ago.
Category: Programming
Expert:  LogicPro replied 11 months ago.

Hi
Welcome to JustAnswer
Could you elaborate a little more?

Customer: replied 11 months ago.

Hi
On which topic would you like me to elaborate?

Expert:  LogicPro replied 11 months ago.

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.

Customer: replied 11 months ago.

What im trying to do is "Translate" those 3 pseudo files INTO java / jdbc so i can get the output:
Name is currently
Name has been changed to Pico
Inserting Pico into table Cat

Thats all i want to do for now.

Heres the wikisend link with them inside:
http://wikisend.com/download/518260/Todo.rar

Expert:  LogicPro replied 11 months ago.

Do you have any guidelines about database?
Which database you need to you?
Do you have any table structure?

Customer: replied 11 months ago.

I have installed and use MySQL i havent been given a table structure so i guess i have to create it myself.

Expert:  LogicPro replied 11 months ago.

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

Customer: replied 11 months ago.

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.

Expert:  LogicPro replied 11 months ago.

I meant Java with MS-Access. let me know

Customer: replied 11 months ago.

"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.

Expert:  LogicPro replied 11 months ago.

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

Customer: replied 11 months ago.

Im using Eclipse:Indigo Release
Operating system: Windows
I 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.

Expert:  LogicPro replied 11 months ago.

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

Customer: replied 11 months ago.

the database name is:newdatabase and table: animals
i did: create table newdatabase.animals (name varchar(20) not null);

Expert:  LogicPro replied 11 months ago.

Ok. Please wait for 30 minues while I write the code for you

Customer: replied 11 months ago.

ok thanks i will wait

Expert:  LogicPro replied 11 months ago.

ok :)

Customer: replied 11 months ago.

Hey sorry if i interrupt, how is the code going? :)

Expert:  LogicPro replied 11 months ago.

Almost done. please wait

Expert:  LogicPro replied 11 months ago.

Download AnimalsMySql.zip

Unzip to get complete working Eclipse project
In Data.java, you may need to change the database username and password XXXXX following statement
con = DriverManager.getConnection(url + database, "root", "admin");

You can ask me again using "For LogicPro only" at the start of

your questions like other customers to get instant and fresh

answers.
It will ensure that question is for me.
Please bookmark my profile page:
http://www.justanswer.com/computer/expert-logicpro/
so you can come back and ask me a question anytime.
If you’re a subscriber, you can ask other questions from me at no

additional cost beyond your monthly payment.
Rate this answer as 'Excellent Service' or ask me if you need

more information.

Customer: replied 11 months ago.

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 :)

Expert:  LogicPro replied 11 months ago.

ok,
I will save it.

LogicPro, Computer Software Engineer
Category: Programming
Positive Feedback: 99.4 %
Satisfied Customers: 7422
Experience: Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
LogicPro and other Programming Specialists are ready to help you

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Positive Feedback:

    99.8 %

    Satisfied Customers:

    7396
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Positive Feedback:

    99.8 %

    Satisfied Customers:

    7396
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Positive Feedback:

    99.4 %

    Satisfied Customers:

    5551
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/unvadim/2010-11-15_210218_avatar.jpg unvadim's Avatar

    unvadim

    Computer Software Engineer

    Positive Feedback:

    99.7 %

    Satisfied Customers:

    1147
    Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Positive Feedback:

    100.0 %

    Satisfied Customers:

    944
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/RA/rajivsharma086/2012-6-6_17128_displaypic.64x64.jpg Raj's Avatar

    Raj

    Computer Engg.

    Positive Feedback:

    98.8 %

    Satisfied Customers:

    857
    BE CS, 4+ Experience in Programming and Database (ERP)
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Positive Feedback:

    99.2 %

    Satisfied Customers:

    787
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Positive Feedback:

    99.4 %

    Satisfied Customers:

    590
    11 yrs of programming (PHP, WordPress, XSL, SQL, JavaScript)