❔ Hello guys, I'm just trying to create two functionalities which's borrow and return books.
BlazeBin - amnpmjcagrtk
A tool for sharing your source code with the world!
36 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Hello there
I hope you could help me out with this project 🤗
Are you available?
What are you having problems with?
Thanks a lot for showing up 🙂 I've been stuck with this project for a weeks.
Since I'm a beginner and trying to practice my code skills. I'm building this project where I could enable the user to borrow & return books.
The issue is every time I enter a book title it displays
My goal is that when the user types the title of the book it should borrow by removing the book from libraryBooks and adding it to the MyBooks list.
And the opposite when returning the book
I am bad at coding and I would love to learn how to code, but a project like this seems hard for me to code a lone by my self 🤷🏻♂️
start simpler. can you make a console app that does simple math calculations with two numbers and an operator?
if not, can you make one that takes the user's name input and puts it into a sentence?
Well! These stuff are very simple, I've been doing the a lot through tutorials.
But my project, I think is too advanced for me too.
You can always try to define what you're doing in smaller, more manageable or easier to understand steps 🙂
I've heard this not once but hundreds of times and this are what I'm trying to do.
But if you want we can have a look at the specific issue you're encountering
For example! If I would apply this to my example, how am I going to do this in small steps? Can you provide me with some hints?
Sounds great 😃
For small steps I would mean more the full program or chunks of it, but we can get back to that later 🙂
I would love to learn how to code and very excited, but when I get stuck, it just feels boring and not know what to do or what step should I take.
So my first hint would be here; find where you have the
Please enter a valid book!
in your code so you know at what piece of code you likely have to look.
Plus, does this only happen when borrowing a book, when you return it, or both?You're right. My first issue is in this code
Not really sure where the issue is, but this code gets printed when I type a book title
Even when you enter the correct title?
Yep
Especially when they enter a correct title. The condition is wrong
It's saying the title is invalid when it does exist
Oh! Really. It was some guy who wrote this project for me, I'm not sure if got it right 🤔
Hope you didn't pay 😛
I mean why do we have to riddle this for you? Literally look at the code, it's self explanatory
while Exists is true, print Book Invalid
No, it's just a guy I met who studies computer science, who usually calls me and teaches me how to build projects and explains every line of code.
They've specifically said they're a beginner. But I'd agree to start a bit simpler to get more knowledge of the concepts that are used here
If you are getting used to it, or are trying to your own program, it's beneficial to write it in pseudocode like the example from Ero before you try to "make it work".
It's a bit easier to write down something along of the lines of
You're right. It looks exactly as you described. But I don't know what this line of code exactly means!
That's a predicate, or shortly put;
Given item
x
from the collection of library books, it checks if the Title of Book x
is the same as the title
variable.MyBooks
is a collection. Exists
"walks" that collection, and does a check for every element it finds. for every element it finds, it executes the function x => x.Title == title
where x
is the current element to check
using x
in predicates is very bad practice that way too many people do
MyBooks.Exists(book => book.Title == title)
Ok! Wow, that's a whole amount of rewarding information and tips regarding my project. I learned a lot of things from you guys that I had no idea about it.
This is what confused most are these x stuff.
So is Exists used as a method in this case and not only a word?
Yep, it is a method that belongs to a
List
Ok! Now, I understood almost the whole idea. Let me practice by modifying the code and see if I get it right.
Good luck!
Thank you so much 🤗
Can I show you my updated project so you can just review it later?
Sure, how strict do you want me to be? 😛
You decide 😁
Guys, yesterday, I found out that it was me who changed it from false to true, so it was my fault 😆 https://paste.mod.gg/nhpayuykleaz/2
BlazeBin - nhpayuykleaz
A tool for sharing your source code with the world!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.