Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 1st, 2004, 6:27 PM   #1
capriciousmind
Newbie
 
Join Date: Dec 2004
Posts: 5
Rep Power: 0 capriciousmind is on a distinguished road
Alas, I am but a grasshopper with it comes to C++ and was wondering if you C++ gurus could help me out. I am not asking for you to write the code for me but just give some guidance, resources, hints, possible problems, etc. Here is the assignment:

Assignment:



In general, your C++ program will create an SQL script file. When the script file is executed (by using the START OUTPUT.SQL command in Oracle), this script will create a new table in the database and add data into the table. The name of the table and the names for the table's fields will be specified by the user. The data that will be added to this table will come from the CUSTOMER.TXT file.



* Your program should begin by asking the user to enter the name for a new database table.
* Your program should then ask the user to enter seven names to use for seven fields that will be created in the table.
* Next, your program should create an output text file called OUTPUT.SQL
* In the output file, your program should write the SQL command necessary to remove a table from the database. The table's name was specified by the user in step one above.
* In the output file, your program should write the command(s) necessary to create a new table. The table's name was specified by the user in step one above. The table will contain seven fields and the names of the fields were specified by the user in step two above. The first six fields will hold character data and the seventh field will hold numeric data. You will need to examine the data in the CUSTOMER.TXT file to determine the specific properties of these fields such as:
variable or fixed length character fields
size limits on the fields
integer or floating point number field
which one is the best choice for primary key
Note that each field in the CUSTOMER.TXT file is separated with a comma.
* Next, your program should begin reading data from the CUSTOMER.TXT file. For every line found in the customer file, your program should write into the output file, an SQL statement used to insert data into the newly created table.
For example, you will read the first line of data in the CUSTOMER.TXT file; this line contains seven pieces of data separated by commas. You should write, into the output file, an SQL statement which will add these seven pieces of data as a new record in the table. Your program would then read the second line in the CUSTOMER.TXT file and write an SQL statement which will add these seven pieces of data as a second new record in the table.
Note that the current file contains 10 records, but your program should not rely on that. My test file may contain any number of records, including the possibility of zero records.
Also note, if you find two commas beside each other in the input file, this indicates a NULL data value for that particular field.
* Finally, your program should write into the output file the SQL command necessary to save the changes that your script file makes to the database.

You should test the output from your program to make sure that it is a WORKING script file. You can do this by logging into Oracle and then using the START command to have Oracle load and execute your script file.


Here is what the Customer.txt files looks like:

10010,Ramas,Alfred,A,615,844-2573,0.00
10011,Dunne,Leona,K,713,894-1238,0.00
10012,Smith,Kathy,W,615,894-2285,345.86
10013,Olowski,Paul,F,615,894-2180,536.75
10014,Orlando,Myron,,615,222-1672,0.00
10015,O'Brian,Amy,B,713,442-3381,0.00
10016,Brown,James,G,615,297-1228,221.19
10017,Williams,George,,615,290-2556,768.93
10018,Farriss,Anne,G,713,382-7185,216.55
10019,Smith,Olette,K,615,297-3809,0.00

Thank you for sharing your wisdom.
capriciousmind is offline   Reply With Quote
Old Dec 1st, 2004, 11:02 PM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
You mention C#, yet the assignment is in C++ and the thread is in the C++ forum...
So I assume you want it in C++...

#include <iostream>
using namespace std;

int main (void)
{
   // ...
   cout << "Make your attempt here... " << endl;
   // ...
   return 0;
}
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Dec 2nd, 2004, 1:35 PM   #3
capriciousmind
Newbie
 
Join Date: Dec 2004
Posts: 5
Rep Power: 0 capriciousmind is on a distinguished road
I'm not sure if that was very helpful but I will thank you for being the only one who responded to my inquiry.
capriciousmind is offline   Reply With Quote
Old Dec 2nd, 2004, 4:59 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
It wasn't intended to be helpful - it was to tell you to do it yourself. If you have a specific problem, by all means, post it, but no one on here will do your homework for you. Well, unless you feel like shipping some Oreos over to the UK, that is...
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Dec 2nd, 2004, 5:21 PM   #5
Ade
Hobbyist Programmer
 
Ade's Avatar
 
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0 Ade is an unknown quantity at this point
You know you canbuy Oreos over here
__________________
Don't wound what you can't kill
Ade is offline   Reply With Quote
Old Dec 3rd, 2004, 3:48 AM   #6
Xyler
Newbie
 
Join Date: Sep 2004
Location: South Africa, Eastern Cape
Posts: 28
Rep Power: 0 Xyler is on a distinguished road
I know he said he is new, but you should at least be able to tell the difference between C++ and C# especially if you are actually using it. Could be wrong I have not used C# yet, but most of the time when you open a microsoft product it shows a splash screen with the program name ;P. Could be wrong.

What exactly was the question anyways?
__________________
Be vewwy vewwy quiet. I'm hunting wuntime ewwors.
Xyler is offline   Reply With Quote
Old Dec 3rd, 2004, 7:36 AM   #7
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
The question was can you please do my homework for me beacuse i havent studied and need to stop selling cocaine...
__________________

tempest is offline   Reply With Quote
Old Dec 3rd, 2004, 9:47 AM   #8
capriciousmind
Newbie
 
Join Date: Dec 2004
Posts: 5
Rep Power: 0 capriciousmind is on a distinguished road
I am not asking for you to write the code for me but just give some guidance, resources, hints, possible problems, etc.

I was just asking where to get started. I would have hoped this forum would have been more mature than the others and not have elitists that only pick on the newbies guess I was wrong.
capriciousmind is offline   Reply With Quote
Old Dec 3rd, 2004, 10:04 AM   #9
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
I doubt that they where picking on you. We just get alot of people coming here and asking us to do their homework for them. Have you attempted the code yet? If so, post what you have and then we'll give useful input back. The reason why some many Newbies think that people are beating up on them is because they don't try anything before posting, try out some code then post. All of us here have jobs, school, etc...so we can't write your code for you.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Dec 3rd, 2004, 10:31 AM   #10
capriciousmind
Newbie
 
Join Date: Dec 2004
Posts: 5
Rep Power: 0 capriciousmind is on a distinguished road
Thank you for the useful post Pizentios, I do have some code written but I have a job too. That is why I took alot of offense to the comments; becoming a programmer takes alot of time and effort and when you aren't living on campus and having to pay all your bills and go to college it is tough to concentrate on scholastics. It is not that I am selling cocaine! I am actually at work right now so I do not have my code with me, but when I get home I will show you what I have.
capriciousmind is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:37 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC