plz help on c program language ..
The program will prompt the user to enter username and password. Enter username: fsenel Enter password: 123456 After the user enters username and password and your program needs to authenticate the user by reading “user.txt” file. In this file each line represents a user and the format of a line is as follows (the tokens are space delimited): <Firstname> <Lastname> <Username> <Password> <Role> If there is no user with the username entered, your program should print “No user is found with username fsenel” message on the screen and terminate the execution immediately. If the user exists but the username and password do not match, then your program should print “Username and password do not match” message on the screen and terminate the execution immediately. If the username and password match, then your program should print the menu depending on the user’s role. If the user is admin you should print the admin menu, if the user is student you should print student menu. Admin Menu ************************************************************ * Welcome to AIU Library Management Program * ************************************************************ * Select: * * 1. Search Book * * 2. Add New Book * * 3. Add New User * * 4. Quit * ************************************************************ If the user does not enter a number between 1 and 4 then your program should re-print the admin menu. If the user enters 1 “Search Book” sub menu will be showed up, if the user enters 2 the user will be able to add a new book, if the user enters 3 the user will be able to add a new user, if the user enters 4 your program will be terminated. Student Menu ************************************************************ * Welcome to AIU Library Management Program * ************************************************************ * Select: * * 1. Search Book * * 2. Quit * ************************************************************ If the user does not enter 1 or 2 then your program should re-print the admin menu. If the user enters 1 “Search Book” sub menu will be showed up, if the user enters 2 your program will be terminated. Search Book Sub-Menu ************************************************************ * Search Book * ************************************************************ * Select: * * 1. Search By Title * * 2. Search By Author * * 3. Main Menu * ************************************************************ To search books you should read “books.txt” file. In this file each line represents a book. Since book names, author names, publisher and edition may contain more than one word they are identified inside square brackets. Please see user.txt file. The format of each line is as follows [<Title>] [<Author name>] [<Publisher>] [<Edition>] Example: [C How to Program] [Paul Deitel] [Pearson] [International Edition] If the user enters 1 your program will print Enter title of the book: C How to Program Title: C How to Program Authors: Paul Deitel Publisher: Pearson Edition: International Edition If the user enters 2 your program will print Enter author of the book: Paul Deitel Title: C How to Program Authors: Paul Deitel Publisher: Pearson Edition: International Edition If there is no such a book in the file then print No books are found After printing the search result then print “Search Book Sub Menu again” If the user enters 3 print Main Menu (either Student Menu or Admin Menu depending on the role) Add New Book When admin selects this option, your program should prompt the following items from the user: Enter the title of the book: Computer Networking Enter Author of the book: James F. Kurose Enter Publisher: Pearson Enter Edition: International Edition Then your program should append the following line to the end of the books.txt file [Computer Networking] [James F. Kurose] [Pearson] [International Edition] After appending this line to books.txt, the print “The book titled Computer Networking” has been successfully added to the database. Then print main menu (admin menu) Add New User When admin selects this option, your program should prompt the following items from the user: Enter First Name: Ahmet Enter Last Name: Yildiz Enter username: ayildiz Enter password: antalya Enter role (A for admin, S for Student): S If the username already exists in the file prompt the message “The username is taken please choose another username” and prompt for another user name Enter username: ayildiz2 If the username still exists in the file prompt the message again. If not append the following to the end of user.txt Ahmet Yildiz ayildiz2 antalya S you should define struct for Book and User.
How far did you get and where did you have trouble?
whathaveyoutried.com
Join our real-time social learning platform and learn together with your friends!