Answered step by step
Verified Expert Solution
Question
1 Approved Answer
could I have some help turning this pseudocode into c++ Add record Parameters: string(command), database file Returns: nothing Logic: Parse string Get name, high score,
could I have some help turning this pseudocode into c++
Add record Parameters: string(command), database file Returns: nothing Logic: Parse string Get name, high score, initials, plays, revenue Write data to end of database file with given format If ! score, plays or revenue length are smallerthan field size, write leading zeri first Write information to log file Delete Record Parameters: name, database file Return: nothing Logic: Create new file Loop until end of database file Read name If not nameto delete Write record to new file Else Skip to next line Delete old file Rename new file to correct name Write information to log file . . Edit Record Parameters: string(command), database file Returns: nothing Logic: Parse command Get name, field number, value Loop Read name from database file If name matches name from command Move file pointer to appropriate field Check value to see how many preceding zeroes are necessary Movefile pointer to appropriate location in field Overwrite value Update revenue field if plays was edited Break loop Write information to log file Search Record Parameters: string (name), database file Return: nothing Logic: Loop until end of database file Read name o If search term contained in name Readrest of line Write information to log file Validate Command Parameters: string Return: boolean Logic: Check first character is digit 1-4 Check for space after digit If digit = 1 Check for double quotes aroundname Check for 4 spaces after second double quote Check second field is all digits and is less than 10 digits Check third field has no white space and less than 4 characters Check fourthfield is all digits and is less than 5 digits Check fifth field has dollar sign, decimal point, less than 5 digits before decimal point, 2 digits after decimal point If digit Activate Windows Check for double quotes aroundname Go to Settings to activate Check for 2 spaces after second double quote 0 = 3 0 Check second field is digit 1-3 Check third field forlength If digit = 1 Check value is all digits and is less than 10 digits If digit = 2 Check value has no white space and less than 4 characters If digit = 3 Check value is all digits and is less than 5 digits If all checkspass, return true Else return false Main Logic: 0 . Open batch file, log file and database file While not EOF of batch file Readline O Validate line If line is valid If first character = 1 Add record If first character = 2 Search record If first character= 3 Edit record If first character=4 Delete record Close files . Add record Parameters: string(command), database file Returns: nothing Logic: Parse string Get name, high score, initials, plays, revenue Write data to end of database file with given format If ! score, plays or revenue length are smallerthan field size, write leading zeri first Write information to log file Delete Record Parameters: name, database file Return: nothing Logic: Create new file Loop until end of database file Read name If not nameto delete Write record to new file Else Skip to next line Delete old file Rename new file to correct name Write information to log file . . Edit Record Parameters: string(command), database file Returns: nothing Logic: Parse command Get name, field number, value Loop Read name from database file If name matches name from command Move file pointer to appropriate field Check value to see how many preceding zeroes are necessary Movefile pointer to appropriate location in field Overwrite value Update revenue field if plays was edited Break loop Write information to log file Search Record Parameters: string (name), database file Return: nothing Logic: Loop until end of database file Read name o If search term contained in name Readrest of line Write information to log file Validate Command Parameters: string Return: boolean Logic: Check first character is digit 1-4 Check for space after digit If digit = 1 Check for double quotes aroundname Check for 4 spaces after second double quote Check second field is all digits and is less than 10 digits Check third field has no white space and less than 4 characters Check fourthfield is all digits and is less than 5 digits Check fifth field has dollar sign, decimal point, less than 5 digits before decimal point, 2 digits after decimal point If digit Activate Windows Check for double quotes aroundname Go to Settings to activate Check for 2 spaces after second double quote 0 = 3 0 Check second field is digit 1-3 Check third field forlength If digit = 1 Check value is all digits and is less than 10 digits If digit = 2 Check value has no white space and less than 4 characters If digit = 3 Check value is all digits and is less than 5 digits If all checkspass, return true Else return false Main Logic: 0 . Open batch file, log file and database file While not EOF of batch file Readline O Validate line If line is valid If first character = 1 Add record If first character = 2 Search record If first character= 3 Edit record If first character=4 Delete record Close filesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started