Welcome Guest [Log In] [Register]
Welcome to Scisforums. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
pa help nmn po d2...
Topic Started: Aug 4 2010, 08:31 PM (634 Views)
crasherkie
Member Avatar
Pentium 3
[ *  *  *  * ]
e2 po ung situation....

access mo ung csv file taz ang laman nun eh mga strings and integers tapuz ung sa 3rd column ng csv file is String taz ung sa 4th column nmn eh ung integer ung sa 5th column nmn eh string ulit. taz ang gagawin mo eh

pag aadin mo ung integer part pero ang pag rereferan mo eh ung 3rd and 5th column which is a string..

2 be exact po..e2 po ung link nung file pa DL nlng po ndi po kaxi ako makapagupload sa photobucket for picture..

Click Me yan po ung url sana po ma2lungan nyo ako..
pagaadin po pla ung mga nakuha nung mga player na score...
<a href="http://www.onbux.com/?r=merlinmeraldo"><img src="http://images.onbux.com/banner.gif" border="0" width="468" height="60"></a>
Offline Profile Quote Post Goto Top
 
Firestarter-
Member Avatar
Celeron 2
[ *  *  *  *  *  * ]
crasherkie
Aug 4 2010, 08:31 PM
e2 po ung situation....

access mo ung csv file taz ang laman nun eh mga strings and integers tapuz ung sa 3rd column ng csv file is String taz ung sa 4th column nmn eh ung integer ung sa 5th column nmn eh string ulit. taz ang gagawin mo eh

pag aadin mo ung integer part pero ang pag rereferan mo eh ung 3rd and 5th column which is a string..

2 be exact po..e2 po ung link nung file pa DL nlng po ndi po kaxi ako makapagupload sa photobucket for picture..

Click Me yan po ung url sana po ma2lungan nyo ako..
pagaadin po pla ung mga nakuha nung mga player na score...
Integ prog po ito?
Posted Image
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
crasherkie
Aug 4 2010, 08:31 PM
e2 po ung situation....

access mo ung csv file taz ang laman nun eh mga strings and integers tapuz ung sa 3rd column ng csv file is String taz ung sa 4th column nmn eh ung integer ung sa 5th column nmn eh string ulit. taz ang gagawin mo eh

pag aadin mo ung integer part pero ang pag rereferan mo eh ung 3rd and 5th column which is a string..

2 be exact po..e2 po ung link nung file pa DL nlng po ndi po kaxi ako makapagupload sa photobucket for picture..

Click Me yan po ung url sana po ma2lungan nyo ako..
pagaadin po pla ung mga nakuha nung mga player na score...
xempre pag csv yan edi coma(,) ang delimiter mo...

use the .split() method to separate the data and store it into a string array then just parse the supposedly int type data into an integer via the Integer.parseInt() method tas after parsing you can add them as normal integers... tas kung magrerefer ka sa 3rd and 5th column then you will be accessing index 2 and 4 in your array... just perform this inside a loop until all lines are read... also check where you declare your variables :ani_kis2: ...

just use Scanner or BufferedReader to read the file and don't forget to close the stream after you are done...

btw... di ko pa nakikita ung file... tinotopak browser ko pag rapidshare eh hehe :ani_sob:
Edited by insolence, Aug 4 2010, 09:04 PM.
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
crasherkie
Member Avatar
Pentium 3
[ *  *  *  * ]
dagdag pa po pla..kaxi po ung sa 3rd and 5th column is a string na iba iba ang names..dun po ako nahihirapan..
kunwari po ung first integer eh ung nasa 1st row..taz ung iaadd ko xa kanya eh ung nasa 10th row na...panu ko sila pag aadin kung madaming strings na in between
Firestarter-
Aug 4 2010, 08:56 PM
crasherkie
Aug 4 2010, 08:31 PM
e2 po ung situation....

access mo ung csv file taz ang laman nun eh mga strings and integers tapuz ung sa 3rd column ng csv file is String taz ung sa 4th column nmn eh ung integer ung sa 5th column nmn eh string ulit. taz ang gagawin mo eh

pag aadin mo ung integer part pero ang pag rereferan mo eh ung 3rd and 5th column which is a string..

2 be exact po..e2 po ung link nung file pa DL nlng po ndi po kaxi ako makapagupload sa photobucket for picture..

Click Me yan po ung url sana po ma2lungan nyo ako..
pagaadin po pla ung mga nakuha nung mga player na score...
Integ prog po ito?
wat do you mean po na integ prog?d ko po gets..
Edited by crasherkie, Aug 4 2010, 09:08 PM.
<a href="http://www.onbux.com/?r=merlinmeraldo"><img src="http://images.onbux.com/banner.gif" border="0" width="468" height="60"></a>
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
crasherkie
Aug 4 2010, 09:07 PM
dagdag pa po pla..kaxi po ung sa 3rd and 5th column is a string na iba iba ang names..dun po ako nahihirapan..
kunwari po ung first integer eh ung nasa 1st row..taz ung iaadd ko xa kanya eh ung nasa 10th row na...panu ko sila pag aadin kung madaming strings na in between
use try catch... try mo iparse ung string to integer pag nag generate xa ng exception edi string xa pag gumana converted mo na ung data into an integer then just add them...

another approach is the use of isLetter() method... assuming na lahat ng strings na sagabal eh naguumpisa sa characters from a-z lng... use the charAt() and isLetter()... return value is a boolean.... if its false then it has the potential to be an integer... assuming that your data are all alphanumerics....

example is
String myWord = abcd;
String myNumber = 1234;

if(myWord.charAt(0).isLetter())
System.out.println("myWord is a Word");



if(myNumber.charAt(0).isLetter())
System.out.println("myNumber is a Word");
else
System.out.println("myNumber is a Number);
Edited by insolence, Aug 4 2010, 09:17 PM.
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
crasherkie
Member Avatar
Pentium 3
[ *  *  *  * ]
Posted Image

e2 po ung pic nung csv file..xenxa na po pla..ndi ko gets ung nasabi mo po eh..xenxa po..

PS:
negative numbers po eh ung sa lakers score taz ung positive is for the boston.
Edited by crasherkie, Aug 4 2010, 09:30 PM.
<a href="http://www.onbux.com/?r=merlinmeraldo"><img src="http://images.onbux.com/banner.gif" border="0" width="468" height="60"></a>
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
crasherkie
Aug 4 2010, 09:28 PM
Posted Image

e2 po ung pic nung csv file..xenxa na po pla..ndi ko gets ung nasabi mo po eh..xenxa po..

PS:
negative numbers po eh ung sa lakers score taz ung positive is for the boston.
teka po... sa anung environment nio po ba to gagawin? spreadsheet or implementing it in a programming language?

logical approach
looking at the image...
if your 2nd column is blank then points for boston otherwise its a point for lakers
then just determine who's point is it and add it to their total...
another is then indication that if a score is - then its the point for lakers
then if there is a - just extract the number then add it to the total of lakers

di mo po kasi nalagay kung saan mo xa gagawin kaya nagkakalituan tau hehe...
Edited by insolence, Aug 4 2010, 09:46 PM.
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
crasherkie
Member Avatar
Pentium 3
[ *  *  *  * ]
implementing it in a java programming language po ung gagawin ko kuya..

try ko po ulit iexplain..ahmm..ang gagawin po is.

1. Read the File
2. Determine what is the score of each player na nasa game.

nagwa ko na po ung read the file. ang di ko lng magets is panu ko ipag aadd ung 2 integers na magkalau ang range..and ung name ang reference :ani_meow:
<a href="http://www.onbux.com/?r=merlinmeraldo"><img src="http://images.onbux.com/banner.gif" border="0" width="468" height="60"></a>
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
actually ganito...
CSV diba coma separated value
so pag naread mo ung per line... split mo xa tas lagay mo sa array...

ngaun string type padin xa diba...

just get the score... parse it into an integer... assuming na may int variables ka na lakerScore at bostonScore...
lagay mo ngaun sa forloop... determin mo kung positive or negative yun naparse mo... pag positive edi bustonScore += parsedValue
pag negative lakerScore += persedValue * (-1)

example
Scanner myReader = new Scanner("Scores.csv");
int lakersScore = 0;
int bostonScore = 0;
String rawData;
while((rawData = myReader.nextLine()) != null)
{
String[] data = rawData.split(","); //separates individual data
if(data[3].charAt(0) == '-')
lakersScore += Integer.parseInt(data[3]) * (-1);
else
bustonScore += Integer.parseInt(data[3]);
}
myReader.close();


ang nangyayari jan eh pinagaad nia lahat ng - pero dinidisregard nia ung negative sign
at inaad nia rin ung positive numbers

negative -> lakers
positive -> buston

pero kung pinarequire na dapat gagamitin nio pa 3rd and fifth colum as reference... same with some minor revisions

while((rawData = myReader.nextLine()) != null)
{
String[] data = rawData.split(","); //separates individual data
if(data[2].length > 0)
lakersScore += Integer.parseInt(data[3]) * (-1);
if(data[4].length > 0)
bustonScore += Integer.parseInt(data[3]);
}

ang nangyari nmn eh pag empty string ung 3rd column edi point ng boston pero pag may laman nmn edi sa lakers hehe...
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
crasherkie
Member Avatar
Pentium 3
[ *  *  *  * ]
ndi paps.....kukunin mo po kung ilang ung score ng player for the whole game...

kunwari si kobe ang iscore nyo for the whole game is 33, ang lalabas po dpat eh.

"Kobe Bryant score 33 points."

ganya po dpat ang lalabas..xenxa kung medyo magulo ung explanation ko... :ani_heh:
<a href="http://www.onbux.com/?r=merlinmeraldo"><img src="http://images.onbux.com/banner.gif" border="0" width="468" height="60"></a>
Offline Profile Quote Post Goto Top
 
insolence
Member Avatar
Dual Core
[ *  *  *  *  *  *  * ]
edi detect mo lng ung name... parang kapag may laman ung data[2] or kung wala ung data[4]... split mo ulet xa pero ang gagamitin mong delimiter eh space para iextarct ung first name tas gamitin mo ung first name sa control statement mo para malaman kung kaninong player ung score na un hehe...

or kung gusto mong medyo dynamic... gawa ka ng class mo tas extract mo dun ung details na nid mo... un ang ipass mong parameter sa constructor... tas gamit ka arraylist<players>... tas kung wala pa ung player name na un sa list mo add mo xa... or kung meron na access mo ung score nia tas idagdag mo ung score na iaadd mo hehe... bigyan sana kita ng code tunkol jan pero baka bawal d2 sa forums kaya ung algo nlng nya hehe...

basically nasau na kung panu iimplement...

lowlevelprogram:
kung ang gagawin mo nmn eh ready made na ung player names... just compare it from the data you have read then if its a match... add the score to the score of the corresponding player hehe...

just exploit the .split() Integer.parseInt() and the if() statement and of course Arrays :)

it would be easier if you will integrate user-defined classes... para at least mastore mo ung different attributes to one data entity
I Played RF online and Became on of the TOP players
Then I got banned permanently cause of the DDM SK bug
I Played RF Olympic and Owned the Highlevels
Then I got banned for Camping Once
Yet the CW urge is still coming back to me
Offline Profile Quote Post Goto Top
 
Firestarter-
Member Avatar
Celeron 2
[ *  *  *  *  *  * ]
subject yun :)
Posted Image
Offline Profile Quote Post Goto Top
 
crasherkie
Member Avatar
Pentium 3
[ *  *  *  * ]
wat do u mean po?
<a href="http://www.onbux.com/?r=merlinmeraldo"><img src="http://images.onbux.com/banner.gif" border="0" width="468" height="60"></a>
Offline Profile Quote Post Goto Top
 
Firestarter-
Member Avatar
Celeron 2
[ *  *  *  *  *  * ]
nvm :P
Posted Image
Offline Profile Quote Post Goto Top
 
crasherkie
Member Avatar
Pentium 3
[ *  *  *  * ]
haha...ok sbi mo eh...NVM nlng garud natin un..hehehehe...kuya insolence nid help ulit mey error dun sa prog..
<a href="http://www.onbux.com/?r=merlinmeraldo"><img src="http://images.onbux.com/banner.gif" border="0" width="468" height="60"></a>
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
ZetaBoards - Free Forum Hosting
Create your own social network with a free forum.
Learn More · Register for Free
Go to Next Page
« Previous Topic · Programming · Next Topic »
Add Reply


Latest posts is now loading...Please wait...
Free Domain Name Service