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

Create a system which ends when the user wants it to. After a user has used...
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...
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...
in Java, I need to create an array of animals. The user is going to be...
in Java, I need to create an array of animals. The user is going to be prompted to enter the size of the array where a valid size is 10-30(inclusive). Then I have to populate only half of this array. I am not sure how to do that so can you please write comments explaining. Thank you
I need to create Create a new empty ArrayList, Ask the user for 5 items to...
I need to create Create a new empty ArrayList, Ask the user for 5 items to add to a shopping list and add them to the ArrayList (get from user via the keyboard). Prompt the user for an item to search for in the list. Output a message to the user letting them know whether the item exists in the shopping list. Use a method that is part of the ArrayList class to do the search. Prompt the user for...
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...
In html create a Watchlist page in which a user can create as many watchlist as...
In html create a Watchlist page in which a user can create as many watchlist as they wish. This page will contain the list of watchlist, allow the user to create a new watchlist, and delete an existing one. You have to implement the following: a) A list of all the watchlist that a user has created. For now, you can randomly create few. b) An option to create a new watchlist. Make sure you ask the user what the...
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....
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....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT