Question: Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would
Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would like to see the actual code so that I can start preparing myself for next semesters classes.
Here is the pseudo cod:
// Global constants for tax calculations
Constant Real COUNTY_TAX_RATE = .02
Constant Real STATE_TAX_RATE = .04
// main module
Module main()
// Local variables
Declare Real monthSales, countyTax, stateTax
// Get month sales
Call getSales(monthSales)
// Calculate county tax
Call setCounty(monthSales, countyTax)
// Calculate state tax
Call setState(monthSales, stateTax)
// Display tax amount
Call showTaxes(monthSales, countyTax, stateTax)
End Module
// The getSales module gets count of month sales and stores it
// in the inputSales reference variable.
Module getSales (Real Ref inputSales)
Display Enter monthly sales:
Input inputSales
End Module
// The setCounty module sets the county tax and stores it
// in the countyTax reference variable.
Module setCounty(Real monthSales, Ref countyTax)
Set countyTax = monthSales * COUNTY_TAX_RATE
End Module
// The setState module sets the state tax and stores it
// in the stateTax reference variable.
Module setState(Real monthSales, Ref stateTax)
Set stateTax = monthSales * STATE_TAX_RATE
End Module
// The showTaxes module accepts monthSales, countyTax, stateTax
// as arguments and displays the resulting data
Module showTaxes(monthSales, countyTax, stateTax)
Declare Real totalTaxes
Set totalTaxes = countyTax + stateTax
Display "Amount of Monthly Sales: $", monthSales
Display "Amount of County Sales Tax: $", countyTax
Display "Amount of State Sales Tax: $", stateTax
Display "Total Taxes: $", totalTaxes
End Module
Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
