PROJECT ITEM ENTRY, MONITORING, and UPDATE | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

PROJECT ITEM ENTRY, MONITORING, and UPDATE

This is supposed to be a CRUD Operation but the update part is not working, I want to store a new value for a specific array without using an ArrayList. when I try CASE 2, it is all good. It displays the Updated information whenever I edited a value. but when I tried to get to CASE 3. the Updated Info didn't display, the original inputted values are the ones displayed. UPDATE PART - > Case2 and Case3 https://code.sololearn.com/c0y9lx7vecid

7th Jul 2022, 1:58 AM
Eyy
4 Answers
+ 1
You do not store updates in your arrays or ItemV2 objects. Your ItemV2 objects have the same name but they are not the same instance. Look in this code the principle of using an entity https://code.sololearn.com/cGn4mt4gxD0m/?ref=app
7th Jul 2022, 10:06 PM
Roland
Roland - avatar
+ 1
On line 126, you add the old quantity by 0 but never by the one indicated by the user. https://code.sololearn.com/cDsR0Fl5S8Y7/?ref=app
7th Jul 2022, 5:22 AM
Roland
Roland - avatar
+ 1
Normally, if you update an entity, you should use it as a parameter of your method. It would simplify your code.
7th Jul 2022, 5:32 AM
Roland
Roland - avatar
0
sir how about the display part on Case 3, when I update the values on case 2 and again try to display the updated values on Case3, it is still the display is the original not the updated version
7th Jul 2022, 5:36 AM
Eyy