Answer to Question #278261 in C++ for zain

Question #278261

Write a program to simulate a part of the control logic for a departmental photocopier. There can be multiple (n) users of the system and only one administrator. Your program should present a menu:

C)reat new user

A)administrator

U)ser

Q)uit

On creation, each user is assigned an account type and an id, a number within range from 0-n. Only Administrator can assign account type. Each user is linked to a copy account, either the master account or one of ten project accounts. That linkage is maintained by the administrator, and it can change as users work on different projects. For user, display the menu:

R)equest photocopies

A)ssociations

M)ain menu

In case of request photocopies, prompt for the number of copies and increment the appropriate account. For associations display project ids to which user is linked to. In both cases user should return to the main menu. For an administrator, show this menu: B)alance

M)aster

P)roject

S)tatistics

M)ain menu


1
Expert's answer
2021-12-12T01:17:21-0500
#include <iostream>


using namespace std;


class Employee
{
private:
    int id;
    string accountType;


public:
    Employee(int, string)
    {
        this->accountType = accountType;
        this->id = id;
    }
    Employee() {}
    int getId()
    {
        return this->id;
    }


    string getAccountType()
    {
        return this->accountType;
    }
};


int main()
{
    Employee users[100];
    int i = 0;
    while (true)
    {
        char choice;
        cout << "(C)reate new user\n";
        cout << "(A)dminstrator\n";
        cout << "(U)ser\n";
        cout << "(Q)uit\n";
        cin >> choice;
        if (choice == 'C')
        {
            string typee;
            int id;
            cin >> typee >> id;


            Employee foo = Employee(id, typee);
            users[i] = foo;
        }
        else if (choice == 'Q')
            break;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog