File Handling Register Assignment

For this assignment we had to make a menu where the user could select from several options: “1.register”, “2.login”, “3.update”, and “4.exit”. The user was prompted to enter the number corresponding to what they wanted to do. Since we were on a File Handling unit we practiced writing to files, instead of reading from them. If the user picked “register” they were prompted to then enter a username and a password. This username and password were both written to a file where they were saved. When the user selected “login” they would be prompted to enter their username and password, when they would enter their credentials, the program would read from the file and check against the most recent entry to see if it matches the entered information. With different results if it is correct versus incorrect. The user could also select the “update” feature, which allowed you to change your password. You would be prompted to enter your username then be prompted to enter your current password, then the new password. This new password would be written to the file as a new element in the file. If the user were to choose “exit” the program would stop running. 

 

I decided to break this program down into three bigger classes, from there I broke it down into smaller parts, mainly dedicated to each of the four features of the program. The first large part of the program I made was the User class, which made a user object, which consisted of a username and password, this is what was written to the file in the register feature. The second big part of the program was Utils class, which is where I kept all the methods to write to the file like the updateUser, fetchUser, and createUser methods. The updateUser method was responsible for taking the updated password and writing it to the file. The fetchUser was used in the login part of the program, this method read from the file to get the existing username and password. The createUser method worked in tandem with the register feature, this method would write the new username and password to the file.  For the last part of the project, the main class, it was one big switch statement that took the user input and based on the input, would execute one of the program’s features. I wrote most of the code for each of the features in those switch statements, which in hindsight, I probably could have made them their own methods then called the methods in the switch statements. I would do that if I were to make the program.

 

I enjoyed this project, looking back, I realize that I can use these skills to actually build a menu, with some UI design combined with a database, this could be a full fledged sign-in and sign-up menu. I think that would be pretty cool to design because it combines skills I’ll learn in the future with things I learned in the past. That can be combined to make something that is relevant to the programs I would be writing in industry. This assignment reinforced the fact that computer science is like math, everything can connect to everything else, it is one interconnected field.

Guess Password File Handling Assignment

Hendrerit augue morbi ligula volutpat egestas netus libero nullam, montes himenaeos a dis mattis pharetra. Odio suscipit vestibulum ornare volutpat mus lacinia sem fames, praesent in vivamus mauris habitant maecenas sapien turpis diam