Jaredson Fetiza

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

Recent posts by Jaredson Fetiza

I see so I cant use the same key because it can only contain one value. I thought I was creating a new key with the same name. If I need to create new keys each it loops,is it even possible to loop student record creation using hashmap?
I will try to start from scratch and think of something.
1 year ago

Liutauras Vilda wrote:
So what I was thinking of (and that is purely to work on the structure you laid down with Map<String, Map<String, String>>):

But again, I'm not entirely sure what you can use in your assignment. It doesn't say that you are not allowed something, nor it does say what you are allowed. Only you said you are not allowed that and that. So I'm not sure.

Wait I don't get it. Isn't this what I am trying to do? Except that the main problem is I cant do what's in your comment.
1 year ago

Campbell Ritchie wrote:What sort of course is this?

Computer Science?
1 year ago

Liutauras Vilda wrote:Why? Could you give an example please.

Because I need to create a new one each time it loops?
- like this

Am I doing it right? What did you have in mind?
Honestly I am willing to start over from scratch cause I feel like it shouldn't be this complicated and there is a simpler approach of doing this haha
1 year ago

Overriding happens when you have the key you are about to add already added to a map.

For instance

Yeah but I cant create new keys and value with my approach (not that I know of) because it is a loop using the same hashmap. I am experimenting with the hashmaps methods rn like
clone(), keyset(), clear() or values to somehow see if I can get around that.
1 year ago
This is the instructions for the task if it helps.
Create a student database program that stores student records, which consist of:

Student ID
Full name
Year enrolled
The user will be asked whether they will enter a new student record or to search for a student record.

If they will search for a student then ask them for the student ID. If the student ID is found output the details of the student, if not then output not found.

If they will enter a new student record then allow the user to enter the students new details.

The program must also keep looping until the user inputs "quit".
1 year ago
We just covered:
- Arrays
- Arraylists
- For each loop
- Multidimensional Arrays
- Arraylist
- Hashset
- Hashmap

Are there no hashmap methods I can use to somehow do I want after line 24?
1 year ago

Liutauras Vilda wrote:Welcome to the Ranch and enjoy the stay. -Thanks

We have not really covered classes,methods or objects yet. Our professor evaluates us based on how we use what was taught in class.
1 year ago
I am creating a student database that
- Lets user create new student records
- Lets user find a student record by their student ID
- if the student is found, output their details
This is the code I made:

After the first loop, if I choose to create a new student record it will to start to overwrite the previous one and I get two hashmaps with the same values inside my Hashmap<String, Hashmap<String, String>>:  

How do I create new values for the same hashmap without overwriting the previous inputted hashmaps? I am not supposed any methods, classes or anything object related.
1 year ago
Yeah sorry about that, the curly brackets on line 16 and 39 is something I forgot to delete when I finished the code.
And I understand that the enter 7 can be confusing so I'll try to make it clear next time.
1 year ago
Kinda late but I was able to do what I wanted with this:

Thanks for the help      
Feel free to tell me if there was a better way I could have gone doing it.
1 year ago
Woah this my first time using tags, its a mess.
1 year ago
Create a program that allows users to:

1. Create new "users" with a username and password combination
2. "Log in" with any username and password combination.
You must store these username-password combinations in your program, and the program must notify the user if the login was successful or not

For the 1st condition I tried:

But I get InputMismatch the second time and I dont know why?
As for the 2nd condition:

Here I get a hashmap.containsKey is always false.
I dont know why these errors appeared so I want to know what I did wrong exactly.
Do I have the right ideas?  How can I correct this?

1 year ago
I'm back. Been trying out some things for an hour and this is where I get stuck. We just received a hint that a loop is used and the loop only ends if "Quit" is entered.
also the Scanner is inside the loop. So while (userinput != "yes") at the very beginning?
1 year ago
You are right. I guess my laziness got the better of me . I will try to do it as best as I can then come back again to ask for some help, is what I would like to say but I am sleepy as hell so I would most likely do it tomorrow. Oh and we have not covered OOP yet so we are expected to solve with only using what we covered.
1 year ago