logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Jovette BermanBusiness
(5/5)

708 Answers

Hire Me
expert
Peter BernerGeneral article writing
(5/5)

820 Answers

Hire Me
expert
Thaissa LannesLaw
(5/5)

926 Answers

Hire Me
expert
rahul kumarOthers
(/5)

912 Answers

Hire Me
C++ Programming

this assignment focuses on one program. This section outlines the overall problem itself, we will then explain the parts in more detail in following sections.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Problem overview

Unlike previous assignments, this assignment focuses on one program. This section outlines the overall problem itself, we will then explain the parts in more detail in following sections.

User accounts - a common problem

Early computer systems were designed with a mind set of serving a single user for a single task. These programs would assume that the person at the keyboard is an authorized user, and without question assist that user in the program’s one and only task. This is the mind-set we have taken in all our programs so far. Modern programs, however, often are developed differently. Modern programs are often designed to accomplish many related tasks, and modern programs are often designed to assist many possible users.

As we switched from single-user programs to multiple-user programs we needed to solve two problems. First we needed some way for the users to identify themselves and have different access to different personal data. The second problem was that the system now needed to protect possibly private user data. A system that provides unlimited access to any user’s data should not be trusted with any private data at all.

These two problems combined to the familiar username and password system we use today. Usernames allow a person to identify themselves within a given system, both to other users of the system, and also to the system itself. Passwords (short strings that are not to be shared with other people) can be used to prove an identity. This way only a human who knows the correct username and password would be given access to private user data.

In this homework we will be writing USMASY, a simple simulated user account system for a multi-user program.

USer MAnagement SYstem (USMASY)

The USer MAnagement SYstem (referred to by it’s acronym USMASY (pronounced “us-mass- sea”) is a simplified multi-user program, designed to be part of a larger programming system. USMASY plays the vital role of managing user account data, both usernames and passwords. USMASY will present itself as a menu-based text user interface. The user will be able to enter several commands to USMASY:

  • help - The help command should show a brief list of the available commands to the

  • load - The load command should prompt the user for a USMASY data file to load into Each USMASY data file contains a list of users and their private passwords.

  • login - The login command should allow a user to try to login, they should first type their username, then they should get three tries at entering a If they can enter a correct password in that much time the system should print “login successful” otherwise it should print “login failed”. In a real system, after a successful login the user should be provided a new user-specific menu. We will not be supporting that behavior in this version of USMASY.

  • adduser - the add user command should allow a new user to be created by getting a username and a password. If the username is already in use the add-user should fail. Otherwise it should take a password and add a new

  • save - the save command should take a filename and write the accounts file out of memory and back to This would need to be done after an added user or else the changes would not be expected to save.

  • exit - the exit command exits the

A Note on Computer Security

It should be noted that Computer Security is a massively complicated field of study. While we will be exploring some of the highest level ideas of this field in this homework with our program, you should be aware that the solutions we will use for this problem are not security best standards. In an actual computer system where the privacy or security of real people is on the line the code you will write here would not be considered secure. A secure user password management system:

  • would not compare two literal strings (this type of password checking is prone to “side channel attacks” in which the computer can be observed to learn about a user’s )

  • string passwords should not be literally stored on disk (this type of storage is susceptible to many forms of hacking, once hacked the passwords can be taken and used on other While an ideal user would not reuse passwords, most due and even a low-security system being compromised can rapidly lead to much more dangerous or problematic violations)

  • string passwords should not be stored in memory (see above, it’s harder to get passwords out of computer memory, but it’s quite )

Any system that has usernames and passwords owes it to the system’s users to maintain best practice standards for password safety and security. What we are programming quite simply, is not that. Do not store any real or meaningful username or password information into this program, it’s not safe. Do not use this as the basis of any login system that you would need to program in the future. it’s not safe.

Problem A: SystemUser class (35 pts)

For this problem you should start by writing a SystemUser class to represent one user to the USMASY system. We’ve designed this class with a few principals in mind, most importantly: there should be no way to access a password and updating the password should only be possible with the password. These rules are slightly broken by the streaming operators << and >>, but should otherwise be maintained in all methods and friend functions.

The SystemUser class should have the following private member variables.

  • username: the name of the user

  • password: the user’s

The class should have the following public member functions:

  • A default constructor that sets the username and password to “empty” (the literal 5 letter word “empty” not an empty string)

  • A two argument password that takes an initial username and

  • A getUsername method that allows access to the

  • A setUsername method that allows modification of the

  • A checkPassword method that takes an input password and checks if it is correct or not, returning a

  • An updatePassword method that takes as input the old password (as entered by the user) and the new This should update the password member variable to the new password, but only if the old password was entered correctly. This should return a boolean indicating true (the password was updated) or false (the password was not updated)

  • Operator overloads for operators == and !=. Equality between two accounts should be based only on the username, not the (so two SystemUser objects that share a username would be considered equal even if they have different passwords). You can do this either as a function, a friend function, or as a method, this is your choice.

  • Operator overloads for the streaming operators << and >>. These should follow best standards for these functions as discussed in class, and should work with cin/cout or file input/output streams.

There is no main method for part A. You should, however, independently create your own tests for these methods. Going forward onto part B without confidence in the correctness of your part A is foolishness that will cost you precious time in this assignment.

Problem B: USMASY main method (65 pts)

Part B asks you to write the USMASY main method. The general outline of this is given above, with examples being shown below to help explain. Here we will give some general hints/require- ments, and then specific details about each command.

Requirements

  • You should use an array of type SystemUser in the main method to store user data read in from the USMASY

  • Your program repeatedly prompt users for a command until they enter “exit”

  • If an invalid command is given it should print an appropriate error (See examples)

  • The load command should load data from a USMASY file into the SystemUser array, all other commands should simply use this

  • While you can assume that the USMASY file is less than 10,000 users long, you cannot assume any specific size for the file, and therefore should be tracking the current size of the system user database alongside the array you store the system users

HINTS

  • Start by writing the command loop and getting that correct, then focus on saving and loading.

  • For each command write a separate function that handles the command. Pay attention to what inputs this function might need, and what outputs it might

  • Make heavy use of the class and methods from part A. Always be checking to see if the SystemUser class has a way to accomplish the goal you currently Don’t forget to consider operator overloads as well.

  • This program is probably one of the longest ones we’ve written, but it shares many parts in common with problem’s we’ve already tackled, and it has lots of “filler”. Make Sure to start early! so that you have a little extra time for the extra typing that will be

help command

The help command should simply print information about USMASY and return to the main loop. Format for this can be found in the examples.

load command

Requirements

  • The load command should fail with an error if user data has already been loaded, either by adding users or the load command. If you are tracking the current number of users this is easy to

  • The load command should start by prompting the user for a USMASY file

    • We will store user accounts in a text file with usernames like “accounts.usmasy” your computer will not recognize this file name, but you should still be able to load this file in any text editor as it will be text

    • The user account file will have one user per line, listing their username and then their password.

    • A single test account file has been provided, it should initially have 2000

  • This command should use the overloaded >> operator that you wrote in part A to read from the This loop can be done in three lines of code (five counting braces).

save command

Requirements

  • The save command should start by prompting the user for a USMASY file

    • We will store user accounts in a text file with usernames like “accounts.usmasy” your computer will not recognize this file name, but you should still be able to load this file in any text editor as it will be text

    • The user account file will have one user per line, listing their username and then their password.

  • This command should write the currently loaded user account array to a file as a valid usmasy file. You can test if it’s a valid file by restarting the program and trying to load

  • This command should use the overloaded << operator that you wrote in part A to read from the This loop can be done in three lines of code (five counting braces).

login command

Requirements

  • This function should start by prompting for a

  • If an account with the username cannot be found output an error and return to the main loop

  • If an account with the username can be found it should prompt the user for a

  • If the password is correct, it should print “login successful” and control should return to the main

  • If the password is incorrect, it should print “ERROR: incorrect password”, and the user should be allowed to try

  • After 3 failed login attempts, an error should be printed and control should return to the main

add user command

Requirements

  • The add user command should prompt for a username and password

  • If the username is already being used by a previous user, the add should fail, an appropriate message should be printed, and control should return to the main

  • If no other user is using the username, the user should be added and control should return to the main

HINTS

  • use the overloaded >> operator to read the user input for username and password

  • use the overloaded == or != operators to check for duplicate

  • While it’s possible to do this task without using these operators/overloads, it’s a bit of a menace, and I don’t recommend

  • Make sure to adjust the count of users as

exit command

Requirements This should print “goodbye!” before the program exits.

Examples

The following examples are to help illustrate the expected formatting of this program, and the expected behavior.

Example 1

This example does not load or save, simply making users as needed for the program.

Welcome to USMASY the user management system enter command:             help

ERROR: unknown command:      hel type help for a command list enter command:                help

Welcome to USMASY the user management system The USMASY commands are:

  • help

  • load

  • login

  • addUser

  • save

  • exit

enter command:    login username:                     doug

ERROR: unable to find user data enter command:             login

username:    empty

ERROR: unable to find user data enter command:             addUser

username and password:    doug |)0uG enter command:             login

username:    doug password:                     doug

ERROR: incorrect password password:                     douggie

ERROR: incorrect password password:                     passowrd ERROR: incorrect password

ERROR: login failed after 3 incorrect attempts enter command:             login

username:    doug password:                     |)0uG login  successful enter command:  save

enter a USMASY file name:  test1.usmasy enter command:             exit

Goodbye!

 

After this example, the file “test1.usmasy” should have the following contents:

doug |)0uG

Example 2

This example starts after Example 1 and uses the test1.usmasy file.

Welcome to USMASY the user management system enter command:             load

enter a USMASY  file name:   test1.usmasy enter command:             login

username:    doug password:                     |)0uG login successful

enter command:    addUser

username  and  password:   doug douggie1 ERROR: username in use

enter command:    addUser

username and password:    douggie douggie1 enter command:             login

username:    douggie password:                     |)0uG

ERROR: incorrect password password:                     douggie1

login  successful enter command:                               save

enter a USMASY file name:  test2.usmasy enter command:             

After this example, the file “test2.usmasy” should have the following conts:

doug |)0uG douggie douggie#1

 

Example 3

In this example our user loads the wrong file and finds they cannot load after having already loaded

Welcome to USMASY the user management system enter command:             load

enter a USMASY  file name:   test1.usmasy enter command:             load

ERROR: user data already loaded. enter command:    

 

Example 4

In this example the user tries to load the wrong file name, then adds a user and finds they cannot load a file after adding a user.

Welcome to USMASY the user management system enter command:             load

enter a USMASY file name:     wrongFile.usmasy unable to open wrongFile.usmasy

enter command:    addUser

username and password:    doug doug enter command:             load

ERROR: user data already loaded. enter command:             accounts.usmasy

ERROR: unknown command:      accounts.usmasy type help for a command list enter command

Compilation instructions

This is a multiple-file project, as such you should expect to be compiling the program manually, on the command line.

For this project, if you follow the file name guidelines below, you should be able to use the following command (on linux machines) (Note, you will need to use the cd command to move to where the files are stored first.)

g++ HW8.cpp SystemUser.hpp SystemUser.cpp -o HW8

You could then type

./HW8

followed by enter, to run your program (Assuming no compilation errors).

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme