mike karl

Greenhorn
+ Follow
since Mar 21, 2013
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
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mike karl

I have tried to solve this problem in so many ways that i am out of options. i have tried to create a RMI application from Orcale tutorials but get lost at running the program. i created the class files for the server and start rmiregistry. then when i try running the server i get a security exception although i have created a policy file
policy file is under C:\Users\BigApeWhat\workspace\RI_Engine\src
ComputeEngine.class is under C:\Users\BigApeWhat\workspace\RI_Engine\src\Compute

reg.policy


cmd prompt




I have also tried to do this task with the genady plugin in which i also get an error. but this time the server runs and the client connot




Any help will be grateful
9 years ago
I have a file that is allready formatted to initialize a 2d double array but i do not know how to initialize it while reading the file

Sample file:
{5.1,3.5,1.4,0.2,0}, {4.9,3.0,1.4,0.2,0}, {4.7,3.2,1.3,0.2,0}, {4.6,3.1,1.5,0.2,0}, {5.0,3.6,1.4,0.2,0}, {5.4,3.9,1.7,0.4,0}, {4.6,3.4,1.4,0.3,0}, {5.0,3.4,1.5,0.2,0}, {4.4,2.9,1.4,0.2,0}, {4.9,3.1,1.5,0.1,0},
{5.4,3.7,1.5,0.2,0}, {4.8,3.4,1.6,0.2,0}, {4.8,3.0,1.4,0.1,0}, {4.3,3.0,1.1,0.1,0}, {5.8,4.0,1.2,0.2,0}

I understand i can copy everything in the folder and paste it in my program but im trying to learn new things.
10 years ago
This has everything to do with generics i would recommend reading about it on the java site. -> Generics
But everything inside <HERE> is the type you will be using so you cannot say that you will use 2 types in your case a "list" and "arraylist" just like you wouldnt do this
int temp = new String();
although before you classify the type you can use inheritance since ArrayList inherits from List it is ok to do
List<Integer> temp = new ArrayList<Integer>(); but not ok to do this ArrayList<Integer> temp = new List<Integer>();
since List does not inherit from ArrayList
10 years ago

Piet Souris wrote:The easiest way is to give each button a dedicated actionlistener.
Another method would be to use the method e.getSource()
or e.getActionCommand(), where e is the ActionEvent parameter of
the actionPerformed() method.



thank you so much, e.getSource() is what i was looking for, my problem is hard to explain but that is what i needed, thank you
10 years ago
how do i find out which button was pressed that triggered an actionlistener. if possible
10 years ago
this is basically the short hand version of my class, just a question, how can i use my setOrder method to set the order for customer, amount, and date instead of writing 3 different methods for each one

10 years ago

Winston Gutkowski wrote:

mike karl wrote:i started you off a little, you have to figure out how to not use the same letter more than once, i would use an arraylist but its possible with just an array, dont capitalize the first letter in your method, and use capitalization for your class


Mike,

All good advice, but if you are suggesting a change to somebody's code, just provide the change (and actually, even better, point them in the right direction to change their own code, rather than supplying them with "solutions").

I read your post as a complete solution and was just about to delete it (we don't like that sort of stuff here).

Winston



im sorry i just wanted to provide a starting template, i will keep that in mind next time
10 years ago

Winston Gutkowski wrote:

mike karl wrote:is it really that badly done,


Fraid so; although I think I understand what you were attempting to achieve.

this is my second semester in programming and my teacher doesnt explain much, im not sure how i can revise this if im not even sure what this is, i never used iterators. i never set up a enumerator to perform sorting. i need some helpful advise


And you've already received it. Most of us have BTDTGTTS, so unless you haven't shown any effort (which you plainly have), we're not trying to belittle you.

The fact is that Fred's absolutely right, you've decided on an implementation (your code) before you've understood the problem - and that's always a bad sign - and now you're in the position of trying to defend the indefensible.

My advice: StopCoding (←click) before you have too much invested in this to turn back.

There are plainly some good ideas in your attempt; it just happens to be wrong.

Here's a possibility for you: Have your enum (one of your good ideas) implement java.util.Comparator<Bill>. Have a think about it and see if it makes any sense.

Winston



ok thanks ill see what i can do, just understand i am in Poland and they dont explain well enough, i feel like i am being rushed through alot of material but maybe its just me.
10 years ago

fred rosenberger wrote:

mike karl wrote:i have to write a method setOrder() which takes enumeration constant defined in Report so iterating over Bills is performed in the order specified by this constant and i have have no clue where to start.
this is what i have so far, let me know what i did wrong and what i should do next.


What you did wrong was to start writing code without thinking about what you should do.

The single most important thing a programmer needs to do is NOT WRITE CODE. Before committing a single byte to file, you should think through the problem in very NON-java terms. you should pretend you are explaining to a child what needs to be done.

Only when you've done that, revised it and simplified it several times, should you write any actual code.

So I would say your next step is to delete what you have, turn off your computer, and put pencil to paper.



is it really that badly done, this is my second semester in programming and my teacher doesnt explain much, im not sure how i can revise this if im not even sure what this is, i never used iterators. i never set up a enumerator to perform sorting. i need some helpful advise
10 years ago
i started you off a little, you have to figure out how to not use the same letter more than once, i would use an arraylist but its possible with just an array, dont capitalize the first letter in your method, and use capitalization for your class

10 years ago
i have to write a method setOrder() which takes enumeration constant defined in Report so iterating over Bills is performed in the order specified by this constant and i have have no clue where to start.
this is what i have so far, let me know what i did wrong and what i should do next.

10 years ago
I have this problem that this is my second semester in programming and i have assignments like this which i cannot understand since the teacher in Poland do not explain very well. i understand the usage of abstract classes, how they can be used and for what reasons, but what i dont understand in this example is how to (reference to the current user, or making a command like kate.buys(carrot))
i just need some help understanding this material

Problem 1.4 Write a set of classes representing shopping in a supermarket.

* Purchase: name of product, unit price, quantity.
* Cart: contains a list (collection) of products put into this cart, reference to the current user (object of class Customer) etc.
* Customer: name, reference to the currently used cart, list of bills (objects of class Bill) for purchases already completed and paid. Customer having a cart can put products into the cart (kate.buys(carrot)) and pay for all products at
checkout (object of class CheckOut) receiving the Bill.
*CheckOut: remembers customers who already have paid (kate.pays(checkout) and/or checkout.checksOut(kate) and their bills (which are also rememered by Customers). CheckOut can be asked for a report (object of class Report).
* Bill: represents bill with customers's name, date, list of products, amount paid etc.
* Report: report of checkout with list of bills paid at this checkout.
______________________________________________________________________________






10 years ago