jihwan kim

Greenhorn
+ Follow
since Aug 01, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jihwan kim

Update I created a MainComp(ensation) and a Compensation class.
Does it look like I am heading in the right direction? It compiles lol, but Iam having trouble testing this because i dont know how to print the variables from the array in format.







Apologies if this looks atrocious.

Regards
Jihwan
10 years ago
Hello

I am working on a mini project and was wondering if I could get some guidance on creating a class that fields an array.
My program Is suppose to read from a txt file into an array. I know how to do parallel arrays, but after hours of coding I am starting to see some problems with respect to complexity and ambiguity.

If I created a class called Compensation I know that my basic constructor, that has 4 variables, would look something like this:




My question is how do I make it so that when I read in the data these 4 variables will be in the array Compensation?
Would stating

solve my issue?

I am having trouble with arrays. I dont even know If I should be dealing with arrays, however it seems like the most reasonable thing I should be doing. Reading through other forums, and through "Absolute Java 5th ed. Savitch,Mock" hasnt helped me understand it fully.

Most Appreciated
Jihwan


10 years ago
Thanks for the reply Ashish.
I didnt even think about looking up a program to help integrate excel with java because I've always done everything from scratch (fml).

=1995: Aluacha Balaclava College=
Aluacha Balaclava College, an undergraduate facility, has just hired a new provost whose first priority is the institution of a fair and reasonable faculty compensation system. She has hired your consulting team to design a compensation system that reflects the following circumstances and principles.

Faculty are ranked as Instructor, Assistant Professor, Associate Professor, and Professor. Those with Ph.D. degrees are hired at the rank of Assistant Professor. Ph.D. canidates are hired at the rank of Instructor and promoted automatically to Assistant Professor upon completion of their degrees. Faculty may apply for promotion from Associate Professor to Professor after serving at the rank of Associate for 7 or more years. Promotions are determined by the Provost, with recommendations from a faculty committee.

Faculty salaries are for the 10-month period September through June, with raises effective beginning in September. The total amount of money available for raises varies yearly and is generally disclosed in March for the following year.

The starting salary this year for an Instructor with no prior teaching experience was $27,000; $32,000 for an Assistant Professor. Upon hire, faculty can receive credit for up to 7 years of teaching experience at other institutions.

Principles
1. All faculty should get a raise any year that money is available.
2. Promotion should incur a substantial benefit; e.g., promotion in the minimum possible time should result in a benefit roughly equal to 7 years of normal raises.
3. Faculty promoted after 7 or 8 years in rank with careers of at least 25 years should make roughly twice as much at retirement as a starting Ph.D.
4. Experienced faculty should be paid more than less experienced in the same rank. The effect of additional years of experience should diminish over time; this is, if two faculty stay in the same rank, their salaries should equalize over time.

Design a new pay system, first without cost-of-living increases. Incorporate cost-of-living increases, and then design a transition process for current faculty that will move all salaries toward your system without reducing anyone's salary. Existing faculty salaries, ranks, and years of service are shown in Table A.11. Discuss any refinements you think would improve your system.
The Provost requires a detailed compensation system plan for implementation, as well as a brief, clear, executive summary outlining the model, its assumptions, its strengths, its weaknesses, and its expected results, which she can present to the Board and faculty.



**What files can I attach in here so that i can give you the data? I couldnt attach word, pdf, excel, or txt files**
10 years ago
Hello Ranchers

I have a few questions regarding the practicality of using java for some statistical analysis.
I recently started working on a project for my mathematical modeling class that involves solving a problem from a previous MCM, The Mathematical Contest in Modeling.
The question involves creating a new payment system for a hypothetical college given some constraints, such has compensation dependent on experience, starting wages dependent on Rank, and many assumptions that would help to optimize budgeting and compensation (articulation couldve been better).

I've inputted data on excel which consists of 204 rows and 4 columns, with column headers: Case (just a number), Years (years of experience), Rank (associate/prof/instructor), Salary ($).
This data was given by the way, but was only given in a written format (couldnt find anything online to copypasta).

I decided to post here because I am trying to practice coding, and I think that I can apply some of my skills to help aid in some arithmetic manipulation.

**Do you think that its worth creating a program to help me manipulate data to see how variables change**
Iam probably going to fit a logistic model (has an S shape with an upper bound) because the data seems to represent that type of relationship.
I say this because:
1) salaries start out low for Faculty, whether they're an instructor with no Ph.D or an associate prof with a Ph.D
2) prof with more experience should get more compensation than prof with fewer experience but
3) salary compensation equals out over time where years of experience doesnt really matter.

--So salary compensation starts low, gradually increases as faculty gains experience then levels out at somewhat of a "cap" where experience doesnt matter.


I apologize that this should be directed more towards a statistical crowd, however I am asking here because someone most likely has some experience.
Also, I am thinking about making a little program for this because I dont know excel functions very well.


*Some Ideas:
I had some help with creating parallel arrays here, but I think iam going to create a program where these cells are read into arrays, using a class/main, so that I can see where the differences are depending what I want to do. Probably going to create a menu and such, using While loops so that I can perform calculations.

Any ideas or suggestions? I am not that lazy, but would like to know if I should just work with excel or try to read in the data and use both: 1 for multiple manipulation scenarios and another for creating plots/residuals and such.

Thank You
Jihwan
10 years ago

No idea what you're saying here.


Again, not sure what you're saying here
-Jeff


hahahahah

Ok so after going through the code, with the help of cigarettes, I figured out what I was doing wrong.

The troubles I was having with the parallel arrays in the bubble sort was that:
1) I knew I had to compare and swap the elements, but I didn't know how.
2) I thought that I could sort the 3 arrays by using just the 2 original parameters for my bubbleSortArray method.
3) I was trying to compare the elements in an all sorts of crazy ways.
4) I just had too much shit written down making things a lot more complicated.

I played around with making more 'temp' variables in conjunction with expanding the parameter for my sort method. and figured out that this was the way to go.
Because I originally had 'int temp;' for my diameters variable, I thought that I could just add more initializations to the int.
Instead I added the string and double parameters, and created String and double temp variables using the SAME algorithm for the diameters variable.

My life was finally complete.
Also got rid of all those extraneous println and printarray statements showing the process of where/what index was switching.

==Here is my Bau5 mode code==


Having gone through the seven circles of hell, I honestly dont think that parallel arrays are that bad. I mean yeah it took my stupid brain a long time to figure out 6 lines of code, but in all seriousness that wasnt too bad.
If i had created a class as You and Campbell have suggested, I think that would've been much more work and unnecessary for this specific code.

I am so grateful so all the help and suggestions. I usually finish my homework promptly but this one was confusing and tricky.
Thank You - jeff, Campbell, Lalit, and Stevens.

regards
Jihwan
10 years ago
Dope, thanks for the response.

Will be back when I finish up some coding.



regards

Jihwan
10 years ago


Or tying yourself in knots because you are stuck with a poor design?


-yes Campbell, this coding is breaking my balls.

It may be that he's doing it this way on purpose--showing you the icky approach first so that you'll appreciate the more OO approach when he has you do it again that way. If so, then I would call that acceptable. If he's actually teaching this as the right way to store and manipulate data though, then I'd take anything he teaches with a grain of salt.


Thanks for responding Jeff. Iam pretty sure he is teaching us the long way to do it, just like in calculus I where you use the fundamental theorem to find the derivative when it shouldnt be that complicated.


It can be done using parallel arrays. When you're sorting, you have to make sure that every change you make to one array gets made to all of them. So if you swap planets[2] with planets[3], then you also have to swap diameters[2] with diameters[3] and lengths[2] with lengths[3].



I get that I have to swap the variables when I am making a change from the index, however I am completely stuck at how to code it right.

Whats messing me up is that because my bubbleSortArray has int[] a as the variable for the diameter index I dont know if I should add more parameters (String[]b or String[]a or double[] a) and make it equal (int[] a = double[] b) to each other when I know that this way is not allowed.*

Wouldnt having the same index parameter 'a' be the right way to go about it because the I am basing everything on the diameters index to keep track of the other 2 variables?

I apologize for using the word I too much, and the fact that I am not explaining my thoughts clearly.

Edit: just wondering would it be easier to create another method so that when I printArray the switched diameter values, this new method would take the Index of the switched diameter and makes it equal to the corresponding planets and lengths index? #derp
regards

Jihwan
10 years ago
Thank you for the reply Campbell.
It is definitely easier for me to create a class where it reads in the txt file to create 1 array instead of creating 3 separate arrays.
I ask because usually when my prof assigns homework he outlines whether or not we need a Class and/or Main.

He's a nice guy and all, but he makes us follow an unspoken rubric (i.e what the instructions says) so that we show him that we know how to do exactly what he asks us to do. I am not complaining by any means, I just have to follow instructions

Unless I am interpreting this the wrong way the instruction says:
Read the data into three parallel arrays
*planets(String) * = bullet points
*diameters(int)
*lengths(double)

Anyway I'll probably make 2 projects, one with and one without parallels.

Not lazy; parallel arrays require much more work than a proper object‑oriented solution. You have to follow all your parallel arrays; if you sort array1, you have to duplicate all changes exactly in array2, array3, etc. That is error‑prone, and there is a risk of your missing out a change somewhere. Sorting a Planet[] array means you sort one array, and all the data for each Planet object stay together in that object.


I hear ya. I am trying to see if i can keep up with this sorting by doing everything in my bubbleSortArray method but I dont think that is going to work.
Can you not typecast values stored in arrays? I thought sorting and tracking would be easy seeing that i could make the index of my int variable equal the index of the double variable (a[j] = b[j]).
Then I thought about declaring 4 more variables in my bubbleSort (i,j,k,l,m,n) to do the same thing except make them = to each other to keep track , however that lead me to the problem of int[] != double[] and String[] !=int[].

Sorry for rambling but I am in thinking mode for finalz.

Much appreciated
Jihwan



10 years ago
Wow thanks for reminding me that I am stupid. I was suppose to create parallel arrays, but i thought that meant something else...
Guess I have to rework my code!


EDIT: Just wondering is there a way to create parallel arrays in just my Main instead of creating a separate class?
And why are some people (internets) saying that creating parallel arrays isnt a good idea? Are they just lazy or is it a bad coding technique/etiquette?


Much appreciated Jeff


Regards
Jihwan
10 years ago
I have reworked the code and figured out what the problem was.
I also changed the variables i and j in the bubbleSortArray method to n and m because I was initially worried about i and j corresponding with the variables in the main. Now I know that what i thought was completely mistaken because of different/new initializations.

Anyway I have:
1) changed the inequality in the second for-loop for the bubbleSortArray method.
2) added println statements to make sure that what i was doing was right.
3) figured out why i was getting repeated zeros when i wanted to print.
*I forgot to add the ++ to my array variables which made it so that only the last value (pluto) was stored in*



~~~~NEW QUESTION!~~~~
Now that I have bubble sorted my "diameters" array what would be the best way to sort my "planets" and "lengths" array to keep it straight when I sort the"diameters" array?

I am thinking that I can use my bubbleSortArray to make the changing n/m variables equal to a new String and a new Double variable which coincide with the other arrays.
Do you think that would be too clustered or is my thought process not doable?


Thank you-
Regards

Jihwan
10 years ago
Thanks for responding guys. It's finals week for me so I am doing a lot of things at once, so if i dont reply fast enough it's not because I forgot or that I am ignoring the posts!

Going to take the suggestions and read aloud what my program is actually doing.



Will report when I have time, I apologize for your time.


regards
Jihwan
10 years ago
Hello All,
I am working on an assignment at the moment was wondering if I could receive some guidance.

What I am trying to do is read 3 columns from a text file and to put them into 3 arrays.
After putting them into arrays a Bubble sort method is used to sort the data using 1 of the arrays.

My program will read the file, put them into arrays, and print them out just fine, however the bubble sort method is giving me some trouble.

=Here is my code=



I followed a template from my instructor for the bubble sort method and i think its ok?
the output for the bubble sort shows the value of the LAST "diameters" followed my 9 zeros on the same line.
The project is not yet compete and i would like to take this step-by-step if you were wondering why this didnt make sense.
Any help would be much appreciated.

Regards
Jihwan



10 years ago
Thank you for the reply Greg

I was surprised that the program ran at all for you considering it didnt work for me.

I've been working on this all day, and although it isnt perfect I think its pretty good so far.







Its pretty messy, and I used the for loops because I didn't know how to insert those *. Thinking back now, I should have just used left/right justifications with printf, but I am not too familiar.

The problem I am encountering now is that when I input a last name with a possible suffix (i.e., Oconnor the 3rd, or, davis III) the program jumps/prints 3 lines, and goes to the unionType prompt.

Employee first Name: John
Employee last name: David the Third
Employee social security numer: The character 'c' for city office or 's' for suburban office: The character 'u' for union or 'n' for non union member:


Is this occurring because of my first printf statement, the fact that its correlating my input space/white space with (%s %s %s)?



Thank you
Jihwan Kim
11 years ago
Hello all!

This is my first post, so please excuse me if my formatting for submission is wrong

I've been working on an assignment that deals with inputting data for an employee time card, then printing out a paycheck. This is suppose to be a loop program where the data input and printing of paychecks doesnt stop until the firstName of DONE is used as a sentinel for stopping the program.

The data input has to be exactly:
first name
last name
Soc sec officeType (city||suburb) unionType (union||non-union) #regularHours payrate #dependents overtime
Ex:
John
Doe
123456789 c n 80 9.55 3 5.5



My question is if I am setting up everything right, and what I could improve on.
Another problem that I am having is that when i compile this program using BlueJ (what I use in school), but working on Notepad++, it doesnt let me input anything, and nothing shows up on my screeen. I tried testing the "DONE" sentinel in the early stages of my program, and it didnt seem to work at all.
I have a lot more questions, but ive asked enough for this post.
Any help is much appreciated!









Thank you
Jihwan Kim
11 years ago