I want you to write me a program in c++ The blue images are examples of the library system. I want you to do the same in

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

I want you to write me a program in c++ The blue images are examples of the library system. I want you to do the same in

Post by answerhappygod »

I want you to write me a program in c++
The blue images are examples of the library system. I want you to do the same in the program, but my program will be about
airport system
Array :
1-Passengers Information (Name ,Age,id) 2-Trip destination 3-Flight date
Array size: defind by user
Menu: Represent the main services explained above.
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 1
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 1 (41.74 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 2
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 2 (71.06 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 3
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 3 (32.14 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 4
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 4 (38.42 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 5
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 5 (50.91 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 6
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 6 (40.47 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 7
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 7 (49.06 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 8
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 8 (40 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 9
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 9 (55.17 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 10
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 10 (67.02 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 11
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 11 (47.29 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 12
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 12 (35.96 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 13
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 13 (57.75 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 14
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 14 (58.29 KiB) Viewed 43 times
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 15
I Want You To Write Me A Program In C The Blue Images Are Examples Of The Library System I Want You To Do The Same In 15 (57.75 KiB) Viewed 43 times
Assignment Specification: your program should include the following: • Functions (should include both: pass by value and pass by reference variables, void function and function returning any value) • Array of structs (at least one single array of struct) • Selection and repetition structures as needed • Add your team members names as a comment in the first line of your program. • You should print a menu to the user and offer him/her different services. • Main Services: o adding new item o search for specific item. o update existing record delete. Sort o Display At the start, your program should populate the array(s) from a file and allow the user to edit it. At the end overwrite the same file with the latest contents of the array(s). Provide another statistical report as separate text file e.g. the number of records, with date, time of last update. • The program should continue running until the user chooses to exit it. • Ensure to avoid any errors of any type (Run-time error, logical error, and syntax error). • You can add extra functions if wish to
Criterion Description Functions Files Array and struct 3 3 اليا 0.75 Your functions should show how it helped you to develop more reusable and readable program. Each Functions function should serve correctly to achieve your system Declaration & Call goals. You should use functions overloading and extra methods to achieve your goal. Variables, Struct Effectively make use of arrays including array of struct in your program(s). This include both local and global & Arrays variables. Those arrays should be easily browsed and Declaration searched. Reading from / Successful file access for reading and writing Writing to file Comprehensible, well-documented and well-structured 3 Program Structure programs. Organization of code delivery and quality of code. Expected users' errors should be handled well through: • Using a proper in-depth analysis of all users' Error Handling input and limiting all users' invalid entry. • Handling all expected run-time errors. Successful live demonstration of your working application. Working Demo, • Clear separation of functions; maintainable code; validation Evaluation, Delivery, & Evaluation of the effectiveness of your approach. Justification • Confident, well-rehearsed and professional; rational explanation for your chosen stories • Justification of your approach, design, implementation and testing. 0.75 3 0.75 0.75
Project(Library) • We are going to use the following file structure line#1 is Book ID - books.bit - Notepad File Edit Format View Help 1234 Never Gonna Give You Up Rick Astley 4.5 AAA Thriller 6532 yyyyy bbbbbb Line #2 is Title Line #3 is Artist 7
Creating A struct Structure is called library and contains the following members o Id, title and artist #include <iostream> #include <fstream> using namespace std; struct Library { string id; string title; string artist; }; string fileName =""; string bFileName=""; const int LIMIT = 10; int size=0;
. . Load Data Function : This function loads data form file to array of struct - Name : LoadData Return type: void why we used void? Formal parameters: array of struct , file Name. what is the call type for array of struct is it by refence or by value! oid loadData(string fName, Library lib[]) ifstream inFile; nFile. open (EName.c_str(), ios::in); f(infile.is open() == true || inFile.is open()) ! int counter=0; while (!inFile.eof()) { getline (inFile, lib[counter].id); getline (inFile, lib[counter].title); getline (inFile, lib[counter].artist); counter++; } size=counter-1;} Ise {cout<< "Failed or File is not exist\n";) File.close(); } 9 OD
Project(Library) DisplayData: This function print out the array ofstruct (books data on the screen) IDE 1234 Atle: llever Gonna Give You Up - Name: displayData Artist: Rick Astley 4.5 Return type: void Title: All Formal parameters: array of struct Artist: Thriller 6532 LO: - 10: Title: yyyyy Artist: bbbbbb void displayData (Library lib[]) Process exited after 0.1725 seconds with return value o Press any key to continue... for (int i=0;i<size; i++) { cout << "ID: "<< lib.id << "\n"; cout << "Title: "<< lib.title << "\n"; cout << "Artist: "<< lib.artist << "\n"; } } > 10
Project(Library) saveDatatoFile: This function save data to output file that means data each time data will be erased and printed to the file to ensure that lastest updates is saved 1234 Name : save Datato File Never Gonna Give You Up Return type: void Rick Astley 14.5 Formal parameter: File Name array of struct AAA void saveDatatoFile(string fName, Library lib'l) Ler (ofstream File; 6532 oFile.open (fName.c_str(), ios::out); yyyyy if (ofile.is open() = true || File is open()) { bbbbbb for (int i=0;i<size;i++){ File « lib.id << "\n"; oFile « lib.title << "\n"; oFile « lib.artist << "\n"; } File.close(); cout << "\nData Saved successfully\n"; ) 1 11
Project(Library) addBooks: In this function user Enter data of the book and saved to directly to a file, note that the file is opened in append mode and user will keep enter values until he decides to exit Name : addBooks - Return type: void - Formal parameter: File Name 12
Project(Library) void addBooks (string fName) { ofstream appFile; appFile. open (FName.c_str(), ios :: app); string bookID. title, artist; int choice; if (appFile.is open() == true || appFile. is open()) { do { cout<<"Enter Book ID\n"; cin>> bookID; Enter Book ID cout<< "Enter Title\n"; 12333 cin>> title; Enter Title cout<<"Enter Book Artsit\n"; Codinding in C++ cin>> artist; appFile << bookID <<"\n"; appFile « title <<"\n" ; appFile<<artist < "\n"; cout << "Enter -1 to extit\n"; cin >> choice ; } while (choice!=-1); appFile.close(); cout<< "Books added successfully\n"; } }
Project(Library) : deleteBookByID: in this function user will enter the book ID of the books he wants to delete, if the book is not found a prompt will tell the user that book is not found, after deleting, user has to save data to file using function save DatatoFile in (slide #9) and to print data using function display Data in (slide #8). Note : array of struct is treated like normal array- Enter Book ID you want to delete Name : delete Book ByID 1.23 Return type: void pook not found Formal parameter: array of struct Process exited after 3.593 seconds with return value 8 Press any key to continue ... - Write two versions of this function: 1. Following sequential search algorithm by implementing the sequential search in a function and call the function from deleteBook ByID by sending the array of struct and the required ID: int Sequential SearchForID (Library lib[], int id) 2. Following binary search algorithm implementing the binary search in a function and recursively call the function from delete Book ByID by sending the array of struct and the required ID, low index and high index, int BinarySearchForID (Library lib[], int id, int low, int high) 14 a a I
Project(Library) sortDatabyTitle: In this function Data will be sorted in descending order based on book title. To save data to file or print the data on the screen after sorting in file you can use function save DatatoFile in slide #9, or display Data function in slide #8. Note: array of struct is treated like normal array. Name : sortDatabvTitle Return type: void Formal parameter: array of struct - . Write this function using bubble sort algorithm for sorting the elemen of the array of struct.
Project(Library) • backUpData: in this function we will back up the file that contains the book information by creating a new file with name ended by ” _backup". • off course the source file will be opened for input and the destination file will be opened for output. Name : backUpData Return type: void. Formal parameter: source file name , target file name. books, but books_backup.bt 3/17/2019 1:49 PM 3/17/2019 1:52 PM
Project(Library) 1 void backUpData (string fName, string bName) { ofstream File; ifstream inFile; books.txt 3/17/2019 1:49 PM oFile.open (bName.cstr(), ios::out); | books_backup.bit 3/17/2019 1:52 PM inFile. open (fName.c_str(), ios::in); string line; if (oFile.is_open() && inFile.is_open()) { do { getline (inFile, line); // read from original file oFile<< line << endl; // write to backup file } while (!inFile.eof()); File.close(); inFile.close(); cout<<"File is Backed up seccefully"; } else cout << "Error failed to open or some files does not exist"; 3 17
Project(Library) • In the main program functions are called, it would be better if display menu function is created that allow the user to enter the process he wants to do by using switch statement. This can be done by adding displayMenu function to enhanced the application. Starts the main by declaring the array of struct and file names: const int LIMIT = 1000; Library database (LIMIT); int size=0; String fileName="books.txt", bFileName="books_backup.txt"; Calls to all discussed functions can be : loadData(fileName, database); displayData (database); saveDatatoFile(fileName, database); sortDatabyTitle (database); displayData (database); backupData (fileName, bFileName); addBooks (fileName); deleteBookByID (database); saveDatatoFile(fileName, database); 18
Project(Library) 1 void backUpData (string fName, string bName) { ofstream File; ifstream inFile; books.txt 3/17/2019 1:49 PM oFile.open (bName.cstr(), ios::out); | books_backup.bit 3/17/2019 1:52 PM inFile. open (fName.c_str(), ios::in); string line; if (oFile.is_open() && inFile.is_open()) { do { getline (inFile, line); // read from original file oFile<< line << endl; // write to backup file } while (!inFile.eof()); File.close(); inFile.close(); cout<<"File is Backed up seccefully"; } else cout << "Error failed to open or some files does not exist"; 3 17
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply