Details of this Paper

computer science




Q1. - Find The Bugs (5 bugs);// College maintains a master file of students and credits earned.;// Each semester the master is updated with a transaction file;// that contains Student ID and credits earned during the semester.;// Each file is sorted in Student ID number order. Student name only exists in the master file.;start;Declarations;num masterID;string masterName;num masterCredits;num transID;string bothDone = "N;num HIGH_VALUE = 999999;InputFile master;InputFile trans;OutputFile newMaster;getReady();while bothDone = "N;detailLoop();endwhile;allDone();stop;getReady();open master "studentFile.dat;open transaction "semesterCredits.dat;open newMaster "updatedStudentFile.dat;readMaster();readTrans();checkBoth();return;readMaster();input masterID, masterName, credits from master;if eof then;masterID = HIGH_VALUE;endif;return;readTrans();input transID, transCredits from trans;if eof then;transID = HIGH;endif;return;checkBoth();if masterID = HIGH_VALUE OR transID = HIGH_VALUE then;bothDone = "Y;endif;return;detailLoop();if masterID = transID then;match();else;if masterID > transID then;noMasterForTrans();else;noTransForMaster();endif;endif;checkBoth();return;match();masterCredits = masterCredits + transCredits;output masterID, masterName, masterCredits to newMaster;readMaster();readTrans();return;noMasterForTrans();output "No master file record matches transaction ", transID;readTrans();return;noTransForMaster();output masterID, masterName, masterCredits to newMaster;readMaster();return;allDone();close master;close trans;close newMaster;return;Q2. - The Library keeps a file of all books borrowed every month. Each file is in Library of Congress number order and contains additional fields for author and title. Write the pseudocode for a program that merges the files for January and February to create a new file with all of the books borrowed in the two-month period. Be sure to use appropriate modules !;Q3. - Do the following Exercise. Be sure to use appropriate modules ! Norman's Department Store keeps a record of every sale including a transaction number (T1, T2,?), the dollar amount of the sale, and the department number in which the sale was made (department number values are 1 through 3 for this example). Design the logic for a program that inputs the sales data (transaction number, dollar amount of sale, and department number) which are sorted by department number, and outputs a report to a file showing the department number, transaction number and amount for each sale, with a total dollar amount at the change/end of each department and a Grand Total at the end of the report (see sample below).;Sample data for "NormanSales.txt" inputfile;T1, 250, 1;T2, 500, 1;T3, 100, 2;T4, 300, 2;T5, 200, 2;T6, 350, 3;T7, 250, 3;T8, 150, 3;Sample of the OUTPUT (report file - "NormanReport.txt") - do not worry about the spacing between data;Sales by Department;Department Transaction Sales Value;1 T1 250;1 T2 500;Department Total is 750;2 T3 100;2 T4 300;2 T5 200;Department Total is 600;3 T6 350;3 T7 250;3 T8 150;Department Total is 750;Grand Total is 2100


Paper#71651 | Written in 18-Jul-2015

Price : $27