Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a dynamic Login System for our CIS14 Computer Labs. Assuming there are 4 computer labs (Lab#1-#4) in our R Building on campus, each lab

Implement a dynamic Login System for our CIS14 Computer Labs. Assuming there are 4 computer labs (Lab#1-#4) in our R Building on campus, each lab having 10 computers (Computer #1-10):

Lab#1: 10 computers

Lab#2: 10 computers

Lab#3: 10 computers

Lab#4: 10 computers

The user can log into any available ONE computer with any ID that is 5 ASCII characters long (e.g., Ab231, !pas!, ab00~, etc). To be clear an ID can be of any 5-character combination from the ASCII table. ID is case-sensitive (that is it, ID "cis14" is different than ID "CIS14"). Logout is only possible with the exact spelling of the ID in the system. To begin the user is presented with the following SELECTION MENU with the 4 options:

In this assignment, you are asked to implement a LoginSystem class as follows:

class LoginSystem { // 2D array holding Lab#s and corresponding Computer#s string** labs; public: LoginSystem(); ~LoginSystem(); void showStatus(); void showMenu(); void login(); void logout(); void search(); };

Grading for this assignment is broken down into how you implement each of the following elements of your Login System and the correctness of your end result for each element. Please pay attention to your Syntax/Logic for each element. Efficiency is NOT graded but your logic is.

Implementation for main():

Create your LoginSystem instance

Invoke showStatus() and showMenu()

Enable selection of the 4 menu choices

LoginSystem()

Dynamic allocation of your 2D array, labs

LoginSystem()

Dynamic de-allocation of your 2D array, labs

void showStatus()

This function prints the status of all Lab#/Computer# slots as follows When a Lab#/Computer# slot is available, not in use, the program displays the string empty for that slot When a Lab#/Computer# slot is taken the program prints the user ID occupying that slot Initially when no one is logged in all Lab#/Computer# slots should be empty:

void showMenu()

This function prints all available user options, namely, LOGIN, LOGOUT, SEARCH, and QUIT as follows:

When LOGIN is selected:

The program prompts Enter your 5-character ID to login:

The program checks whether the ID contains any 5 ASCII characters

If not the program repeats the prompt "Enter your 5-character ID to login: until it receives ID containing 5 ASCII characters. Note "empty" is not a valid ID

If yes the program proceeds to the next prompt

After a valid ID is received the program prompts Enter the Lab #:

The program checks whether the Lab # is a number between 1-4

If not the program repeats the prompt "Enter the lab #:" until it receives a valid Lab #

If yes the program proceeds to the next prompt

After a valid Lab # is received, the program prompts Enter the Computer #:

The program checks whether the Computer # is a number between 1-10

If not the program repeats the same prompt "Enter the Computer #:" until it receives a valid Computer #

If yes the program proceeds to the next step

The program checks to see if the computer has already been used. If so the program displays "ERROR, user [ID] is already logged into that station."

The program checks to see if the user has already logged in elsewhere. If so the program prints "User [ID] is in Lab #[LAB_NUM] at Computer #[COMP_NUM] where [ID] is the user ID, and [LAB_NUM] and [COMP_NUM] are the actual lab and computer numbers that the user is associated with. See the example below.

If not the program proceeds to the next step

After everything is entered, at the end of the LOGIN process, the program invokes both showStatus() and showMenu()

When LOGOUT is selected:

The program prompts "Enter your 5-character ID to logout:

The program checks whether the ID contains any 5 ASCII characters

If not the program repeats the prompt "Enter your 5-character ID to logout: until it receives a valid ID. Note "empty" is not a valid ID

If yes the program proceeds to the next validation:

If the valid ID is received but not found in your 2D array data structure, the program prompts That user is not logged in.

If the valid ID is found in your 2D array data structure the program prints User [ID] is logged out where [ID] is the user entered ID such as 12345 in the following example

At the end of the LOGOUT process the program invokes showStatus() and showMenu()

When SEARCH is selected:

The program prompts Enter a 5-character ID to search:

The program checks whether the ID contains any 5 ASCII characters. Note "empty" is not a valid ID

If not the program repeats the prompt "Enter a 5-character ID to search:" until it receives a valid ID

If yes the program proceeds to the next validation:

If a valid ID is received but not found in your 2D array data structure, the program prompts That user is not logged in.

If the ID is found in your 2D array data structure the program prints User [ID] is in Lab #[LAB_NUM] at Computer #[COMP_NUM] where [ID] is the user ID, and [LAB_NUM] and [COMP_NUM] are the actual lab and computer numbers that the user is associated with. See the example below.

At the end of the SEARCH process the program invokes showStatus() and showMenu()

When QUIT is selected:

The program exits (namely, returning from main()), de-allocating all of the dynamic memory in use in ~LoginSystem().

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Accounting questions