Swastik
Swastik Dey wrote:Single = sign is assignment operator
Can you advise me if the items like water, soup etc. should be as a label or gdrawstring?
Swastik
Campbell Ritchie wrote:Welcome to the Ranch
Why are you writing applets? They are obsolete. As for a label or writing text onto a panel, that depends on what you are going to do with it.
In which case, why are they teaching applets?Ola Krip wrote:. . . College assigment.. . . .
Campbell Ritchie wrote:
In which case, why are they teaching applets?Ola Krip wrote:. . . College assigment.. . . .
How are you going to get any actions to work? You have several labels with prices on, but can you add action listeners to them? Why have you made the class implement action listener? You might see that in many books, but I think it violates the principles of object‑orientation. It is also unnecessary since the introduction of λs in 2014.
I don't understand how your count of items makes people select a different drink.
I think you are going to have to go back to your design and decide what you are going to do. Write down on paper, without using any computing words, how you are going to count items.
You need to design it before you can implement it. But you seem to have something working. Please show us it and let's see if we can't get some more marks for you.Ola Krip wrote: . . . This part I don't understand how to implement. . . .
Campbell Ritchie wrote:
You need to design it before you can implement it. But you seem to have something working. Please show us it and let's see if we can't get some more marks for you.Ola Krip wrote: . . . This part I don't understand how to implement. . . .
Campbell Ritchie wrote:I can't understand the design. You are adding one to the coffee counter if you click the coffee label? Surely you should push a coffee button. So, you push the coffee button and order one cup of coffee. That means coffee counter = 1 and counter = 1. Then you click for tea, and now coffee counter = 1 and tea counter = 1 and counter = 2. That is what I would expect. Then you have the option of clicking another drink, or finishing. You obviously have only small tables which will only accommodate five drinks, so you have to stop at five. Or maybe it is because you are charging $70 for a cup of coffee and nobody can afford more than five? Or are those numbers coordinates?
I can't understand why you have those tests for counter in the paint() method. What's more, the paint() method is changing the counters. I think that looks wrong.
Ola Krip wrote:
Campbell Ritchie wrote:I can't understand the design. You are adding one to the coffee counter if you click the coffee label? Surely you should push a coffee button. So, you push the coffee button and order one cup of coffee. That means coffee counter = 1 and counter = 1. Then you click for tea, and now coffee counter = 1 and tea counter = 1 and counter = 2. That is what I would expect. Then you have the option of clicking another drink, or finishing. You obviously have only small tables which will only accommodate five drinks, so you have to stop at five. Or maybe it is because you are charging $70 for a cup of coffee and nobody can afford more than five? Or are those numbers coordinates?
I can't understand why you have those tests for counter in the paint() method. What's more, the paint() method is changing the counters. I think that looks wrong.
The number are coordinates. We are not meant to have a button. We are meant to have 1 textfield to input the choice. We need to make a self defined total with a method. The code works, caluclates fine except it doesn't calculate if the product is just :1 ..
Campbell Ritchie wrote:I can't understand the design. You are adding one to the coffee counter if you click the coffee label? Surely you should push a coffee button. So, you push the coffee button and order one cup of coffee. That means coffee counter = 1 and counter = 1. Then you click for tea, and now coffee counter = 1 and tea counter = 1 and counter = 2. That is what I would expect. Then you have the option of clicking another drink, or finishing. You obviously have only small tables which will only accommodate five drinks, so you have to stop at five. Or maybe it is because you are charging $70 for a cup of coffee and nobody can afford more than five? Or are those numbers coordinates?
I can't understand why you have those tests for counter in the paint() method. What's more, the paint() method is changing the counters. I think that looks wrong.
Campbell Ritchie wrote:
In which case, why are they teaching applets?Ola Krip wrote:. . . College assigment.. . . .
How are you going to get any actions to work? You have several labels with prices on, but can you add action listeners to them? Why have you made the class implement action listener? You might see that in many books, but I think it violates the principles of object‑orientation. It is also unnecessary since the introduction of λs in 2014.
I don't understand how your count of items makes people select a different drink.
I think you are going to have to go back to your design and decide what you are going to do. Write down on paper, without using any computing words, how you are going to count items.
I love
--->❤️ Coderanch
------> Github
--------> IntelliJ IDEA
----------> VSCode
You are now in a position where you get good marks for following instructions rather than writing good code. I have seen too many over‑specified assignments, which deprive the candidates of the opportunity to design the application properly. Most of them also require sub‑optimal code. You will have to write poor quality code so you can have good marks .Ola Krip wrote:. . . We are not meant to have a button. We are meant to have 1 textfield to input the choice. . . . .
That tells me it doesn't work.The code works, caluclates fine except it doesn't calculate if the product is just :1 ..
I suppse if they let everybody find out early they are still teaching applets, they wouldn't have any applicants. I am relived to see they have disappeared. Has the Applet class been removed or has it been deprecated? Let's have a look. The Applet class is still there, but, as you saidVictor Nizeyimana wrote:. . . A lot of academies are teaching applets still... is gone now in JDK 11.
I have in my course an assignment to create a card simulator in applets...
It says it was deprecated in Java9.The Applet link wrote:Deprecated.
The Applet API is deprecated, no replacement.
Campbell Ritchie wrote:Welcome to the Ranch
I suppse if they let everybody find out early they are still teaching applets, they wouldn't have any applicants. I am relived to see they have disappeared. Has the Applet class been removed or has it been deprecated? Let's have a look. The Applet class is still there, but, as you saidVictor Nizeyimana wrote:. . . A lot of academies are teaching applets still... is gone now in JDK 11.
I have in my course an assignment to create a card simulator in applets...It says it was deprecated in Java9.The Applet link wrote:Deprecated.
The Applet API is deprecated, no replacement.
I love
--->❤️ Coderanch
------> Github
--------> IntelliJ IDEA
----------> VSCode
In reverse order:-Ola Krip wrote:LOL YOU TELLING ME MY CODE IS MESSED UP DID FIX IT.
I took the counters out form the paint method and it works.... thanks . . .
Thank you Missing some edit button from my last postCampbell Ritchie wrote:Welcome to the Ranch
I love
--->❤️ Coderanch
------> Github
--------> IntelliJ IDEA
----------> VSCode
Campbell Ritchie wrote:
In reverse order:-Ola Krip wrote:LOL YOU TELLING ME MY CODE IS MESSED UP DID FIX IT.
I took the counters out form the paint method and it works.... thanks . . .1: That's a pleasure 2: I still don't understand how you are getting from counter = 2 to prices for tea. 3: Please avoid ALL UPPER CASE WRITING, even when you are fixing code.
We disabled the edit button because we had problems in the past with changes to previous posts.Victor Nizeyimana wrote:. . . Missing some edit button from my last post . . .
Campbell Ritchie wrote:
We disabled the edit button because we had problems in the past with changes to previous posts.Victor Nizeyimana wrote:. . . Missing some edit button from my last post . . .
I love
--->❤️ Coderanch
------> Github
--------> IntelliJ IDEA
----------> VSCode
I am rather more worried that your teachers don't seem to know that. Make sure to keep posting on a good website (there is one here) where people will tell you pretty quickly if you are using outdated stuff.Ola Krip wrote:. . . I'm worried that when I would ever try to get a programming/software development job I will be using outdated stuff! I didn't know applets are not used anymore. . . .
It has been deprecated, not deleted. Read about the @Deprecated annotation.Victor Nizeyimana wrote:. . . some of my teachers are still using JDK 10 and is still working... . . .
All things are lawful, but not all things are profitable.
Manuel Prochnow wrote:...since java 9, the applets have been classified as "obsolete" and I thought it would not hurt to take a different perspective. If this violates agreements, I apologize.
My excuse is still: sorry, I'm new here ....
All things are lawful, but not all things are profitable.
Consider Paul's rocket mass heater. |