Documente Academic
Documente Profesional
Documente Cultură
This second part of Project 1 will be to divide the program into functions and perform
some of the simple calculations.
Interface Design
The following is an example run of the program. An example of input is underlined.
Structure Chart
It is recommended that you use the following functions as part of your design:
Algorithms
main()
Main is the function that signifies the beginning of execution. Typically main() does not
do anything; it just calls other functions to get the job done. You can think of main() as
a delegator. For this program, main() will call the get functions, call
the display() function, and hold the values that the user has input.
main
income ← getIncome()
budgetLiving ← getBudgetLiving()
actualLiving ← getActualLiving()
actualTax ← getActualTax()
actualTithing ← getActualTithing()
actualOther ← getActualOther()
end
getIncome()
The purpose of getIncome() is to prompt the user for his income and return the value
to main():
getIncome
GET income
RETURN income
end
The general design for the other get functions is the same. Note that all input from the
users is gathered in the "get" functions. Also note that there is a tab before the "Your
monthly income:"
display()
Display takes the input gathered from the other modules and puts it on the screen in
an easy to read format. Display formats the output, displays some of the data to the
user, and calls other functions to display the rest. The outline for display() is the
following:
SET budgetDifference ← 0
PUT income
end
A few hints:
computeTithing()
And after that, those who have thus been tithed shall pay one-tenth of all their interest
annually; and this shall be a standard law unto them forever, for my holy priesthood,
saith the Lord. D&C 119:4
computeTax()
We will complete this function in Part C of the project next week. For now, please just
return 0.0.
Assignment
Your assignment is:
g++ project03.cpp
5. Test the program with testbed and fix all the errors:
testBed cs124/project03 project03.cpp
styleChecker project03.cpp
submit project03.cpp
/home/cs124/projects/prj03.out
Program 1
1 syntax More than 2
No compile "conceptual"
compiles errors
compile
compile
compile
10% error errors
error
Data
Functions
incorrectly Multiple Only one
Modularization used in the No errors made in passing
passed functions function
30% most elegant parameters
between used used
way possible
functions
Great Misleading
Programming variable A few style variable Little effort
style names, no No style checker errors checker names or was spent
10% errors, great errors gross style on style
comments errors