Please Help Having issues with pseudocode

Now i am not asking anyone to "do my homework" I need help understanding what I am doing wrong. I am unavailable to get with the teacher as its an online class and the teachers office hours interefere with my job and cant leave work to go to see my teacher. If someone could point out lines i'm having issues with and any details of what im doing wrong it would be greatly appreciated. We are currently in the 12th or 13th week of this class the following replys are the c++ code followed by the pseudocode i was given to do this program. i only have to do the lines marked TODO

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*                                                                                   // A-1-1-01
Author:              Shawn Main                                                      // A-1-1-02
Date Written:        December 11, 2011                                               // A-1-1-02
Course:              CSIS 123, Internet                                              // A-1-1-02
Program:             Task 09-02, Chapter 6                                           // A-1-1-02
Program Description: This application calculates and displays the parking charges    // A-1-1-02
                     for each customer who parked in the garage on a given day.      // A-1-1-02
                     The garage charges a $2.00 minimum fee to park for up to three  // A-1-1-02
                     hours, and an additional $0.50 per hour for each hour or        // A-1-1-02
                     part thereof in excess of three hours.                          // A-1-1-02
                     The maximum charge for any given 24-hour period is $10.00.      // A-1-1-02
                     Assume that no car parks for longer than 24 hours at a time.    // A-1-1-02
Compiler Used:       Microsoft Visual C++ 2010 Express                               // A-1-1-02
SourceFile Name:     Garage.cpp                                                      // A-1-1-02
*/                                                                                   // A-1-1-03
#include <iostream>                                                                  // A-1-1-04
#include <iomanip>                                                                   // A-1-1-05
#include <string>                                                                    // A-1-1-06
#include <cmath>                                                                     // A-1-1-07
#include <cstdlib>                                                                   // A-1-1-08
using namespace std;                                                                 // A-1-1-09
class Garage {                                                                       // A-1-1-10
public:                                                                              // A-1-1-11
   void prepareDailyReceiptsReport() {                                               // A-1-1-12
    int hoursParkedByCustomer [c_customerCount];                                     // A-1-3-001 TODO
    int customerNumber;                                                           // A-1-3-002
    double totalParkingReceipts = 0;                                                 // A-1-3-003 TODO
    double parkingCharge;                                                            // A-1-3-004 TODO
    bool usedMaximumParkingCharge = false;                                           // A-1-3-005 TODO
    bool usedMinimumParkingCharge = false;											 // A-1-3-006 TODO
    getDailyParkingActivity(hoursParkedByCustomer);                                  // A-1-3-007 TODO
       cout << "\n\nToday's Parking Receipts:\n";                                    // A-1-3-008
       displayColumnHeadings();                                                      // A-1-3-009
       for (customerNumber=1;customerNumber<=getCustomerCount();customerNumber++) {  // A-1-3-010
      calculateCustomerParkingCharge =                                               // A-1-3-011 TODO
        (hoursParkedByCustomer[customerNumber-1]                                     // A-1-3-012 TODO
           usedMaximumParkingCharge,    										     // A-1-3-013 TODO
                usedMinimumParkingCharge);                                           // A-1-3-014 TODO
                parkingCharge;                                                       // A-1-3-015 TODO
         totalParkingReceipts += parkingCharge;                                      // A-1-3-016 TODO
         displayThisCustomer                                                         // A-1-3-017 TODO
            (customerNumber                                                          // A-1-3-018 TODO
            hoursParkedByCustomer[customerNumber-1]                                  // A-1-3-019 TODO
            parkingCharge                                                            // A-1-3-020 TODO
            usedMaximumParkingCharge                                                 // A-1-3-021 TODO
            usedMinimumParkingCharge);                                               // A-1-3-022 TODO
       } // for                                                                      // A-1-3-023
       displayReportSummaryLine(totalParkingReceipts "Total Receipts");              // A-1-3-024 TODO
       displayReportSummaryLine                                                      // A-1-3-025 TODO
         (totalParkingReceipts/getCustomerCount(), "Average Fee");                   // A-1-3-026 TODO
   } // function prepareDailyReceiptsReport                                          // A-1-1-13
   private:                                                                          // A-1-1-14
   const static int c_customerColumnWidth = 8;                                       // A-1-1-15
   const static int c_customerCount = 30;                                            // A-1-1-16
   const static int c_defaultChargeColumnWidth = 7;                                  // A-1-1-17
   const static int c_interColumnWidth = 3;                                          // A-1-1-18
   const static int c_hoursParkedColumnWidth = 6;                                    // A-1-1-19
   const static int c_parkingChargeColumnWidth  = 7;                                 // A-1-1-20
   double calculateCustomerParkingCharge;                                            // A-1-1-21 TODO
       double hoursParked;                                                           // A-1-1-22 TODO
       bool &usedMaximumParkingCharge;                                               // A-1-1-23 TODO
       bool &usedMinimumParkingCharge;                                               // A-1-1-24 TODO
          const double c_minimumParkingCharge = 2.0;                                 // A-1-3-027 TODO
          const double c_MaximumParkingCharge = 10.0;                                // A-1-3-028 TODO
          const double c_maximumParkingHoursForMinimumParkingCharge = 3.0;           // A-1-3-029 TODO
          const double c_chargePerHourAfterMinimum = 0.5;                            // A-1-3-030 TODO
          double parkingCharge = c_minimumParkingCharge;                             // A-1-3-031 TODO
          if (hoursParkedByCustomer > c_maximumParkingHoursForMinimumParkingCharge); // A-1-3-032 TODO
            (c_minimumParkingCharge + c_chargePerHourAfterMinimum                    // A-1-3-033 TODO
                          * ceil(hoursParked                                         // A-1-3-034 TODO
                          - c_maximumParkingHoursForMinimumParkingCharge))           // A-1-3-035 TODO
                          = parkingCharge;                                           // A-1-3-036 TODO 


continued on next post

Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
         if (parkingCharge > c_maximumParkingCharge)                                // A-1-3-037 TODO
            usedMaximumParkingCharge = true;                                         // A-1-3-038 TODO
            parkingCharge = c_maximumParkingCharge;                                  // A-1-3-039 TODO
		  else                                                                       // A-1-3-040 TODO
            usedMaximumParkingCharge = false;                                        // A-1-3-041 TODO
          if (parkingCharge == c_minimumParkingCharge)                               // A-1-3-042 TODO
            usedMinimumParkingCharge = true;                                         // A-1-3-043 TODO
		  else                                                                       // A-1-3-044 TODO
            usedMinimumParkingCharge = false;                                        // A-1-3-045 TODO
          return parkingCharge;                                                      // A-1-3-046 TODO
}                                                                                    // A-1-1-25 TODO
   void displayColumnHeadings() {                                                    // A-1-1-26
       cout << "\n\t" << right                                                       // A-1-3-047
          << setw(getCustomerColumnWidth()) << "Customer"                            // A-1-3-048
          << setw(getInterColumnWidth()) << " "                                      // A-1-3-049
          << setw(getHoursParkedColumnWidth()) << "Hours "                           // A-1-3-050
          << setw(getInterColumnWidth()) << " "                                      // A-1-3-051
          << setw(getParkingChargeColumnWidth()) << "Parking"                        // A-1-3-052
          << setw(getInterColumnWidth()) << " "                                      // A-1-3-053
          << setw(getDefaultChargeColumnWidth()) << "Default";                       // A-1-3-054
       cout << "\n\t"  << right                                                      // A-1-3-055 TODO
          << setw(getCustomerCount()) << "Number";                                   // A-1-3-056 TODO
          << setw(getInterColumnWidth()) << " ";                                     // A-1-3-057 TODO
          << setw(getHoursParkedColumnWidth()) << "Parked"                           // A-1-3-058 TODO
          << setw(getInterColumnWidth()) << " ";                                     // A-1-3-059 TODO
          << setw(getParkingChargeColumnWidth()) << "Fee";                           // A-1-3-060 TODO
          << setw(getInterColumnWidth()) << " ";                                     // A-1-3-061 TODO
          << setw(getDefaultChargeColumnWidth()) << "Charge";                        // A-1-3-062 TODO
          << "\n";                                                                   // A-1-3-063 TODO
   } // function displayColumnHeadings                                               // A-1-1-27
      void displayReportSummary                                                      // A-1-1-28 TODO
       (double reportSummaryAmount,                                                  // A-1-1-29 TODO
        string reportSummaryLabel);                                                  // A-1-1-30 TODO
           const int c_reportSummaryRightIndendtWidth =                              // A-1-3-064 TODO
             getCustomerColumnWidth()                                                // A-1-3-065 TODO
             + getHoursParkedColumnWidth()                                           // A-1-3-066 TODO
             + (2 * getInterColumnWidth())                                           // A-1-3-067 TODO
             - reportSummaryLabel.length();                                          // A-1-3-068 TODO
           cout << "\n\n\t" << right <<;                                              // A-1-3-069 TODO
              reportSummaryLabel;                                                     // A-1-3-070 TODO
              << fixed << showpoint << setprecision(2);                               // A-1-3-071 TODO
              << setw(c_reportSummaryRightIndentWidth) << " ";                        // A-1-3-072 TODO
              << setw(c_parkingChargeColumnWidth) << reportSummaryAmount;             // A-1-3-073 TODO
   // A-1-1-31 TODO
   void displayThisCustomer                                                          // A-1-1-32
       (int customerNumber,                                                          // A-1-1-33
        int hoursParked,                                                             // A-1-1-34
        double parkingCharge,                                                        // A-1-1-35
        bool usedMaximumParkingCharge,                                               // A-1-1-36
        bool usedMinimumParkingCharge) {                                             // A-1-1-37
           string defaultChargeLiteral;                                              // A-1-3-074
           if (usedMaximumParkingCharge == true)                                     // A-1-3-075
             defaultChargeLiteral = "Maximum";                                       // A-1-3-076
           else                                                                      // A-1-3-077
             if (usedMinimumParkingCharge == true)                                   // A-1-3-078
               defaultChargeLiteral = "Minimum";                                     // A-1-3-079
             else                                                                    // A-1-3-080
               defaultChargeLiteral = "--   ";                                       // A-1-3-081
           cout << "\n\t" << right                                                   // A-1-3-082 TODO
              << fixed << showpoint << setprecision(2)                               // A-1-3-083 TODO
              << setw(getcustomerNumberColumnWidth()) << customerNumber              // A-1-3-084 TODO
              << setw(getInterColumnWidth()) << " "                                  // A-1-3-085 TODO
              << setw(gethoursParkedColumnWidth) << hoursParked                      // A-1-3-086 TODO
              << setw(getInterColumnWidth()) << " "                                  // A-1-3-087 TODO
              << setw(getParkingChargeColumnWidth) << parkingCharge                  // A-1-3-088 TODO
              << setw(getInterColumnWidth()) << " "                                  // A-1-3-089 TODO
              << setw(getdefaultChargeliteralColumnWidth) << defaultCharge           // A-1-3-090 TODO
           if (customerNumber % 5 == 0)                                              // A-1-3-091 TODO
             cout "\n"                                                               // A-1-3-092 TODO
   } // function displayThisCustomer                                                 // A-1-1-38 


continued on next post
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
   int getCustomerCount() {                                                          // A-1-1-39
       return c_customerCount;                                                       // A-1-3-093
   } // function getCustomerCount                                                    // A-1-1-40
   int getCustomerColumnWidth() {                                                    // A-1-1-41
       return c_customerColumnWidth;                                                 // A-1-3-094
   } // function getCustomerColumnWidth                                              // A-1-1-42
   void getDailyParkingActivity(int hoursParkedByCustomer[]) {                       // A-1-1-43
       const int c_maximumHoursParked = 24;                                          // A-1-3-095
       srand(12321);                                                                 // A-1-3-096
       for (int customerNumber=1;customerNumber<=getCustomerCount();                 // A-1-3-097
           customerNumber++) {                                                       // A-1-3-097
         hoursParkedByCustomer[customerNumber-1] = 1 + rand() % c_maximumHoursParked;// A-1-3-098
       } // for                                                                      // A-1-3-099
   } // function getDailyParkingActivity                                             // A-1-1-44
   int getDefaultChargeColumnWidth() {                                               // A-1-1-45
       return c_defaultChargeColumnWidth;                                            // A-1-3-100
   } // function getChargeColumnWidth                                                // A-1-1-46
   int getHoursParkedColumnWidth() {                                                 // A-1-1-47
       return c_hoursParkedColumnWidth;                                              // A-1-3-101
   } // function getHoursParkedColumnWidth                                           // A-1-1-48
   int getInterColumnWidth() {                                                       // A-1-1-49
       return c_interColumnWidth;                                                    // A-1-3-102
   } // function getInterColumnWidth                                                 // A-1-1-50
   int getParkingChargeColumnWidth() {                                               // A-1-3-51
       return c_parkingChargeColumnWidth;                                            // A-1-3-103
   } // function getParkingChargeColumnWidth                                         // A-1-1-52
}; // class Garage                                                                   // A-1-1-53
int main() {                                                                         // A-1-5-01
    Garage myGarage;                                                                 // A-1-5-02 TODO
    string enterKey;                                                                 // A-1-5-03
    cout << "\nTask 09-02, Ch06, Programmed by Shawn Main";                          // A-1-5-04
    myGarage.prepareDailyReceiptsReport();                                           // A-1-5-05 TODO
    cout << ("\n\nEnd of Program: Press <Enter> to exit program.");                  // A-1-5-06
    getline(cin, enterKey);                                                          // A-1-5-07
} // function main                                                                   // A-1-5-08 
The following is the pseudocode for this program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
A-1-3-001)  DECLARE local int array hoursParkedByCustomer with c_customerCount elements

A-1-3-002)  DECLARE local int customerNumber

A-1-3-003)  DECLARE local double totalParkingReceipts with an initial value of zero

A-1-3-004)  DECLARE local double parkingCharge

A-1-3-005)  DECLARE local Boolean usedMaximumParkingCharge with an initial value of false

A-1-3-006)  DECLARE local Boolean usedMinimumParkingCharge with an initial value of false

A-1-3-007)  CALL private member function getDailyParkingActivity, passing it the following argument: hoursParkedByCustomer

A-1-3-008)  DISPLAY line 4 of Exhibit Z, proceeded by 2 newlines and followed by 1 newline

A-1-3-009)  CALL private member function displayColumnHeadings

 

REPETITION HEADER:

A-1-3-010)  FOR each customer starting from first through last customer, followed by opening brace for body of loop

A-1-3-011)              ASSIGN value returned by CALLing private member function calculateCustomerParkingCharge with the following arguments:

A-1-3-012)                              (hoursParkedByCustomer[customerNumber-1]

A-1-3-013)                              usedMaximumParkingCharge

A-1-3-014)                              usedMinimumParkingCharge)

A-1-3-015)              TO           parkingCharge

A-1-3-016)              SUMMARIZE current value of parkingCharge INTO totalParkingReceipts

A-1-3-017)              CALL private member function displayThisCustomer with the following arguments:

A-1-3-018)                              (customerNumber

A-1-3-019)                              hoursParkedByCustomer[customerNumber-1]

A-1-3-020)                              parkingCharge

A-1-3-021)                              usedMaximumParkingCharge

A-1-3-022)                              usedMinimumParkingCharge

 

REPETITION FOOTER:

A-1-3-023)  Enter closing brace for body of loop

A-1-3-024)  CALL private member function displayReportSummaryLine with the following arguments:

                                totalParkingReceipts and "Total Receipts"

A-1-3-025)  CALL private member function displayReportSummaryLine with the following arguments:

A-1-3-026)              totalParkingReceipts/getCustomerCount() and "Average Fee"
A-1-3-027)  DECLARE local constant double variable named c_minimumParkingCharge with a value of 2.0

A-1-3-028)  DECLARE local constant double variable named c_maximumParkingCharge with a value of 10.0

A-1-3-029)  DECLARE local constant double variable named c_maximumParkingHoursForMinimumParkingCharge with a value of 3.0

A-1-3-030)  DECLARE local constant double variable named c_chargePerHourAfterMinimum with a value of 0.5

A-1-3-031)  DECLARE local double variable named parkingCharge with a value of c_minimumParkingCharge

 

SINGLE-ALTERNATIVE IF statement (no braces required around conditional assignment statement)

A-1-3-032)  If (hours parked exceeds hours parked for minimum charge)

A-1-3-033)              ASSIGN value of expression (c_minimumParkingCharge PLUS c_chargePerHourAfterMinimum

A-1-3-034)                              MULTIPLIED BY the expression ceil(hoursParked

A-1-3-035)                                              MINUS c_maximumParkingHoursForMinimumParkingCharge))

A-1-3-036)              TO parkingCharge

 

DOUBLE-ALTERNATIVE IF statement (braces required around compound-true alternative statements, but not around false alternative statement)

A-1-3-037)  if (parking charge exceeds maximum allowed parking charge)

A-1-3-038)              ASSIGN value of true TO usedMaximumParkingCharge

A-1-3-039)              ASSIGN value of c_maximumParkingCharge TO parkingCharge

A-1-3-040)  ELSE

A-1-3-041)              ASSIGN value of false TO usedMaximumParkingCharge

 

DOUBLE ALTERNATIVE IF statement (no braces required around either true or false conditional statement)

A-1-3-042)  if (parking charge is the same as minimum parking charge)

A-1-3-043)              ASSIGN value of true TO usedMinimumParkingCharge

A-1-3-044)  ELSE

A-1-3-045)              ASSIGN value of false TO usedMinimumParkingCharge

 

A-1-3-046)  RETURN parkingCharge
A-1-3-047)  DISPLAY newline, followed by tab, followed by RIGHT JUSTIFICATION, followed by

A-1-3-048)              appropriate width for, followed by first line of customer-number heading column, followed by

A-1-3-049)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-050)              appropriate width for, followed by first line of hours-parked heading column, followed by

A-1-3-051)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-052)              appropriate width for, followed by first line of parking-fee heading column, followed by

A-1-3-053)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-054)              appropriate width for, followed by first line of default-charge heading column

 

A-1-3-055)  DISPLAY new line, followed by tab, followed by RIGHT JUSTIFICATION, followed by

A-1-3-056)              appropriate width for, followed by second line of customer-number heading column, followed by

A-1-3-057)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-058)              appropriate width for, followed by second line of hours-parked heading column, followed by

A-1-3-059)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-060)              appropriate width for, followed by second line of parking-fee heading column, followed by

A-1-3-061)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-062)              appropriate width for, followed by second line of default-charge heading column

A-1-3-063)              followed by newline
A-1-3-064)  DECLARE local constant int variable named c_reportSummaryRightIndentWidth with a value of the following expression

A-1-3-065)              getCustomerColumnWidth()

A-1-3-066)              PLUS getHoursParkedColumnWidth()

A-1-3-067)              PLUS 2 MULIPLIED BY getInterColumnWidth()

A-1-3-068)              MINUS reportSummaryLabel.length()

A-1-3-069)  DISPLAY 2 newlines, followed by tab, followed by RIGHT JUSTIFICATION

A-1-3-070)              reportSummaryLabel

A-1-3-071)              format manipulators for currency display, followed by

A-1-3-072)              appropriate width for report-summary right indent, followed by literal string for 1 blank, followed by

A-1-3-073)              appropriate width for parking-charge column, followed by reportSummaryAmount
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
A-1-3-074)  DECLARE local string variable named defaultChargeLiteral

 

DOUBLE-ALTERNATIVE, NESTED IF statement (no braces required since none of conditional statements are compound)

A-1-3-075)  IF (maximum parking charge was used)

A-1-3-076)              ASSIGN value of string literal “Maximum” TO defaultChargeLiteral

A-1-3-077)  ELSE

A-1-3-078)              IF (minimum parking charge was used)

A-1-3-079)                              ASSIGN value of string literal “Minimum” TO defaultChargeLiteral

A-1-3-080)              ELSE

A-1-3-081)                              ASSIGN value of string literal "--   " TO defaultChargeLiteral

 

                    DISPLAY a customer line (See Exhibit Z, lines 9-13, 15-19, 21-25, 27-31, 33-37 and 39-43)

A-1-3-082)  DISPLAY newline, followed by tab, followed by RIGHT JUSTIFICATION

A-1-3-083)              format manipulators for currency display, followed by

A-1-3-084)              appropriate width for customer-number column, followed by customerNumber, followed by

A-1-3-085)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-086)              appropriate width for hours-parked column, followed by hoursParked, followed by

A-1-3-087)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-088)              appropriate width for parking-charge column, followed by parkingCharge, followed by

A-1-3-089)              appropriate width for blank space between columns, followed by literal string for 1 blank, followed by

A-1-3-090)              appropriate width for default-charge column, followed by defaultChargeLiteral

 

SINGLE-ALTERNATIVE IF (no braces required since the conditional statement is not compound)

A-1-3-091)  IF (above customer was the 5th, 10th, …, 25th, 30th: you must use the modulus operator here)

                                DISPLAY a blank line after every 5th customer (See Exhibit Z, lines 14, 20, 26, 32, 38 and 44)

A-1-3-092)              DISPLAY newline
A-1-3-093)  RETURN c_customerCount
A-1-3-094)  RETURN c_customerColumnWidth


Topic archived. No new replies allowed.