Question

In: Computer Science

I beg of anyone to answer this :) Create a system which ends when the user...

I beg of anyone to answer this :)

Create a system which ends when the user wants it to. After a user has used this system, there is an option of another user using it. The system should ask whether you want to continue or not. Below is a sample of the input/output system.

Are you a student or a librarian?
Hit 1 for student and 2 for librarian.
$1
Enter Name: $William
How many books do you want to take?
$4
What books do you want to take?
Enter book ISBN no(Ex: 242424) // Let's assume we have a 6 digit ISBN number for this project. Put any number to test //your system.
$454092

$535212

$676685

$128976
William borrowed 4 books.
Hit 1 to continue 0 to end system
$1
Are you a student or a librarian?
Hit 1 for student and 2 for librarian.
$2
Enter Name: $Miss Benny
0 Lisa borrowed 1 books //format: student_id Student_name "borrowed" number_of_books "books"
1 William borrowed 4 books
Type student id for more info.
$ 0
Lisa borrowed 1 books
235633
Hit 1 to continue 0 to end system
$0

//There needs to be an array for studentid, student name, isbn index start #, isbn index end #, and libarian name

//This is also C++,

//If you need further information please specify in the comments and I will edit the problem as needed. I need this information ASAP please.

//The $ represents inputs made by the "user"

Solutions

Expert Solution

Please find below c++ code .

Here use structure for store student details. Also use array for store book details and student details.

#include<iostream>
using namespace std;
//structure for student
struct Student
{
    string name; //name of student
    int id; // id of student
    int book_no; // total number of book
    int book_id[10]; //list of book
}student[10];
int main(){
    int sorl,ch;
    int id=0;
    int scount=0;
    string lname;
    int studid;
    do{
        cout<<"Are you a student or a librarian?\nHit 1 for student and 2 for librarian.\n$";
        cin>>sorl; //read student or librarian
        if(sorl==1){
            Student stud; // create variable of student
            stud.id=id; //set id for student
            cout<<"Enter Name: $";
            cin>>stud.name; // read name of student
            cout<<"How many books do you want to take?\n$";
            cin>>stud.book_no; // read number of book
            cout<<"What books do you want to take?\nEnter book ISBN no(Ex: 242424)\n";
            for(int i=0;i<stud.book_no;i++){ //read isbn of all books
                cout<<"$";
                cin>>stud.book_id[i];
            }
            student[scount]=stud; // assign student object to array
            cout<<stud.name<<" borrowed "<<stud.book_no<<" books"<<endl; // display details
            scount++; // increment count
            id++; //incement id
        }
        // case of librarian
        else{
            cout<<"Enter Name: $";
            cin>>lname; //read name
            // display all student details
            for(int i=0;i<scount;i++){
                cout<<student[i].id<<" "<<student[i].name<<" "<<"borrowed "<<student[i].book_no<<" books"<<endl;
            }
            //display details of specific student
            cout<<"Type student id for more info.\n$";
            cin>>studid;
            for(int i=0;i<scount;i++){
                if(student[i].id==studid){
                    cout<<student[i].id<<" "<<student[i].name<<" "<<"borrowed "<<student[i].book_no<<" books"<<endl;
                    for(int j=0;j<student[i].book_no;j++)
                        cout<<student[i].book_id[j]<<endl;
                }
                }
        }
        cout<<"Hit 1 to continue 0 to end system \n$";
        cin>>ch;
    }while(ch!=0);
    return 0;
}

output


Related Solutions

I want to create an app which a user can talk to and get emotional feedback...
I want to create an app which a user can talk to and get emotional feedback in a form of a conversation. So, a user can talk about how stressful their day was, and my app should reply accordingly so that the user feels better. I want to know what methods(pyschologically) I can apply on my bot so that the user feels satisfied. In short, is there any psychological therapy term which deals with such conversations? Also, what all illnesses...
Create a form in which the user enters two separate numbers (x and y), and when...
Create a form in which the user enters two separate numbers (x and y), and when the user clicks the appropriate button, math functions are performed on these two numbers and output back on to the form. INPUT User can enter two separate numbers (one for the x variable, and one for the y variable) User can input their information: The user must be able to enter information about themselves, including first name, last name, address, phone PROCESSING The user...
6) Create the following in a Java Program: Create payroll system Prompt the user to enter...
6) Create the following in a Java Program: Create payroll system Prompt the user to enter payroll information Employee name and create variable for scanner Hours worked Hourly pay rate Federal tax rate State tax rate Declare variable doubles for gross pay, federal, state and total deduction Display payroll statement example: Name of employee Hours worked Hourly pay rate Gross pay which is equal hours worked multiply hourly pay rate Federal withholding which is equal of gross pay multiply federal...
Hello, #1 I am asked to create a Windows user account that is a non-admin user...
Hello, #1 I am asked to create a Windows user account that is a non-admin user using a.ps1 file. At first, I used the New-LocalUser cmdlet, but this cmdlet does not show up as a user on the start menu of my computer and I cannot use it to log in as another user on my computer. So, instead of using that cmdlet, what could I use to create a Windows user account that I can also log into? #2...
I WANT TO IMPLEMENT THIS IN JAVA PLEASE I want to create a small user input...
I WANT TO IMPLEMENT THIS IN JAVA PLEASE I want to create a small user input system for a university student, where they put the season and year of when they started their uni course. For example the system will ask "What year did you start your degree?", the user will input "Autumn/2022" as a string. Now from a string format as shown, it should take that user input and calculate for example +2 or +3 years to the date....
Create an application that asks a user to answer 5 math questions. JAVA
Create an application that asks a user to answer 5 math questions. JAVA
Can anyone explain to me why I am getting an access violation when I try to...
Can anyone explain to me why I am getting an access violation when I try to add notes? It occurs when I try to set the "pLast" pointer to the previous node (for a doubly linked list). The code worked as singly linked list. When I added a "pLast" pointer and the needed code to make it a doubly linked list everything broke. #include <iostream> #include <stdlib.h> using namespace std; //build class that has a private function to inc count....
I am designing cost comparing/ order app. Can anyone create prototype of this app include that...
I am designing cost comparing/ order app. Can anyone create prototype of this app include that features: cost comparing, offer& coupons, user reviews, order tracking , interactive buttons, design.
1) Create a "Can I be President?" program. The program determines if the user meets the...
1) Create a "Can I be President?" program. The program determines if the user meets the minimum requirements for becoming the President of the United States. Use user input. The rules for being president of the U.S. are: Older than 35 Resident of US for 14 Years Natural born citizen Print True if the person could be president and False if they can't be president. 2) Alter one line of that program to be a "I can't be President?" game....
I have 3 tables, but I need that when the user logs in and enters his...
I have 3 tables, but I need that when the user logs in and enters his login and password, it shows me only the information of that client. But it is showing me the information of all the clients. Bank(mid,code,cid,sid,type,amount,mydate,note) from CPS300 This is the table where I want the information of a client to be seen Customers(id,name,login,password) from CPS200 Sources(id,name) from CPS200 --------------------------------------------------------------------------------------------------------------------------------- for now I have two queries, but I must correct the one for client authentication because...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT