Question

In: Computer Science

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 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

#include <iostream>
using namespace std;
int i=-1;
struct student
{
   int id;
char name[50];
int nobook;
int book[100];
};
struct library
{
char name[50];
};
library l;
student s[10];
int student_details(int i)
{
   s[i].id=i;
cout << "Enter name: ";
cin >> s[i].name;
cout << "no of books: ";
cin >> s[i].nobook;
cout << "Enter book ISBN : ";
for(int j=0;j<s[i].nobook;j++)
       cin >> s[i].book[j];
return 0;
}
int librarian_details()
{
cout << "Enter name: ";
cin >> l.name;
for(int j=0;j<=i;j++)
{
   cout<<j<<" "<<s[j].name<<" borrowed "<<s[j].nobook<<"books"<<endl;
   }
   cout<<"Type student id for more info.\n" ;
   int info;
   cin>>info;
   for(int k=0;k<s[info].nobook;k++)
   {
       cout<<s[info].book[k]<<endl;
   }
return 0;
}
int main()
{
   int choice;
   while(1)
   {
       cout<<"Are you a student or a librarian?\n";
       cout<<"Hit 1 for student and 2 for librarian.\n";
       cin>>choice;
       switch(choice)
       {
           case 1:i+=1;
               student_details(i);
                   break;
           case 2:librarian_details();
                   break;
           default:cout<<"wrong choice\n";
       }
       cout<<"Hit 1 to continue 0 to end system\n";
       int choice1;
       cin>>choice1;
       if(choice1==0)
       {
           exit(0);
       }
   }
   return 0;
}


Related Solutions

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...
What is LIMA? When was it released to the public? What system was used to create...
What is LIMA? When was it released to the public? What system was used to create the data? What is the resolution of the data? what scientific questions are hoped to be addressed by the data?
Purpose For many users, the system is the user interface. Everyone wants a system that is...
Purpose For many users, the system is the user interface. Everyone wants a system that is easy to learn and use. It is the analyst’s responsibility to ensure that the user interface will be designed in a way to support the user’s interface needs.   In this milestone you will explore the guidelines for user interface design. The analyst must consider a variety of interface formats. These include how data gets entered into the system (input design) and how data or...
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...
matlab Q1) a) create a vector that starts at a, ends at b, and has a...
matlab Q1) a) create a vector that starts at a, ends at b, and has a spacing of c (allow the user to input all of these parameters) b)create an inches vector using a,b and c c) calculate the corresponding values of feet in another vector (1feet=12 inches) d) group the inch vector and the feet vector together into a table matrix e)use the disp command to create a title for a table that converts inches to feet f)use the...
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...
Suppose a user wants to do a system call. Assume that the service routine of this...
Suppose a user wants to do a system call. Assume that the service routine of this system call is at physical address 500., instead of executing a system call, the user simply jumps to this location 500. Assume that logical and physical addresses are the same and no memory protection is in place, i.e., cpu does not check that this address 500 is beyond the user’s memory space. Will something go wrong while the service routine executes?
Martin wants to create a program that requires the user to input 10 integers then print...
Martin wants to create a program that requires the user to input 10 integers then print the total number of even integers, highest even integer, lowest even integer, total number of odd integers, highest odd integer, and lowest odd integer. If, however, the user inputs zero (0), the program will display “You have not yet entered 10 integers.” Below is the sample output of the program Martin created. Enter the integers: Integer 1: 15 Integer 2: 9 Integer 3: 71...
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...
When a user signs in for the first time to a website, the user has to...
When a user signs in for the first time to a website, the user has to submit personal information, such as userid, name, email address, telephone number and so on. Typically, there are two fields for passwords, requiring the user to enter the password twice, to ensure that the user did not make a typo in the first password field. Write a class encapsulating user with the following elements: UserID Password Reentered password Email address Name Street Address City State...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT