diff options
| author | Musa Ahmed <[email protected]> | 2022-11-30 17:48:53 -0800 |
|---|---|---|
| committer | Musa Ahmed <[email protected]> | 2022-11-30 17:48:53 -0800 |
| commit | aaea2967bc68003cb052c564e2009379d5481bcc (patch) | |
| tree | 03e7d69f170938bf0e8264b4bf6b144fe82b259e /BlankConsoleLab/CST116-Lab3-Pseudocode.txt | |
| parent | added pseudocode and output files (diff) | |
| download | cst116-lab3-m005a-aaea2967bc68003cb052c564e2009379d5481bcc.tar.xz cst116-lab3-m005a-aaea2967bc68003cb052c564e2009379d5481bcc.zip | |
renamed the files
Diffstat (limited to 'BlankConsoleLab/CST116-Lab3-Pseudocode.txt')
| -rw-r--r-- | BlankConsoleLab/CST116-Lab3-Pseudocode.txt | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/BlankConsoleLab/CST116-Lab3-Pseudocode.txt b/BlankConsoleLab/CST116-Lab3-Pseudocode.txt deleted file mode 100644 index 059fda7..0000000 --- a/BlankConsoleLab/CST116-Lab3-Pseudocode.txt +++ /dev/null @@ -1,73 +0,0 @@ -Initialize a constant int MAX for the maximum amount of records, set to 50 - -START MAIN - -initialize function ReadData, with input file, arrays, and counters -initialize function WriteOutputFile with output file, counters, and arrays -initialize PrintTotalsAndSummary with output file, counters, and arrays - -Initialize an array for each needed value, with the length being equal to max -initialize record counter -initialize people counter -initialize payment counter - -initialize filename -initialize input file -initialize output file - -prompt the user to input a filename wiht extension - set the input equal to filename - -open the file - -if the file is open - call the function ReadData and have its return value be set into record_counter - - close the input file - - if the output file is open - call the functions writeoutputfile and printotalsummary - close the output file - - else - print an error message -else - print an error message - -return 0 - -END MAIN - -ReadData - - prints out headers corresponding to each array - read in the first line of data from the input file and have it set to the first of each array - - while it is not the end of the file - the totalfare at the current index is equal to the far + toll - print out the arrays at the current index, formatting into a table - - if the distance at the current index is 0, the cost per mile is 0 - otherwise the cost per mile is equal to the total cost over the distance - - increment the index - read data again - - return counter - - -WriteOutputFile - - enter a for loop which goes until the end of the total records in the file - print out all the modified data to the output file at the current index - -PrintTotalsAndSummary - - enter a for loop which goes until the end of the total records in the file - set the total amount of people to the array of passCount at the index added together - set a double temp equal to the far + toll at the current index - paid += temp - the totalFare at the current index is equal to temp - - print out the avg cost per person, # people transported, and the total cost to both - the screen and the output file. |