You are on page 1of 3

How

to Create and Submit Your Programming Assignments


Step 1: Design your program using pseudocode. You do not need to include a flowchart.
Step 2: Create the .cpp file. Make sure you have your name and the assignment in a header block at the
top of your file. Make sure to include a statement as to the function of the program. Also
describe input from the user and output to the user.
Heres an example of a header block for #14 (Monthly Sales Tax), on page 144. This should appear at
the top of your .cpp file.
/******************************************************************
Billie Williams
Lesson 3 Programming Assignment #1, Page 144, Number 14
The function of this program is to calculate Monthly Sales Tax based on total monies collected.
Input = month, year, and total collected
Output = total, sales, countyTax, stateTax, and totalTax

******************************************************************/
Step 3: Visual Studio users: After your program is running properly, use the <CTRL><F5> command one
more time. Drag the command screen (output) to a place on the desktop where both the code
(at least some of it) and the output can be seen.

NetBeans users: After your program is running properly, run it one more time. Try to arrange
your screen so I can see both the code and the command window.

Step 4: Do a screen capture using the Print Screen function. This will be your proof that it ran correctly.
Step 5: Create a Word doc with the following items:

Your name, assignment

Pseudocode

Screen shot of the output window and at least some of the editor window visible

Copy of the program code

Then, save that file as a pdf.

Step 6: Submit BOTH your .cpp and the .pdf to me.



Heres an example of how it might look:

Pseudocode:
Prompt and input month, year, and total collected
sales = total/1.06
countyTax = sales*.02
stateTax = sales*.04
totalTax = countyTax+stateTax
output total, sales, countyTax, stateTax, and totalTax



Program Code:
/******************************************************************
Billie Williams
Lesson 3 Programming Assignment #1, Page 144, Number 14
The function of this program is to calculate Monthly Sales Tax based on total monies collected.
Input = month, year, and total collected
Output = total, sales, countyTax, stateTax, and totalTax
******************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{

char month[22], year[7];

double sales, totalCollected, countyTax, stateTax, totalTax;


//Input section

cout << "Input Month and Year separated by a space: " << endl;

cin >> month >> year;


cout << "Input the total amount collected at the cash register: " << endl;

cin >> totalCollected;


//calculate sales and taxes

sales = totalCollected / 1.06;

countyTax = sales * 0.02;

stateTax = sales * 0.04;

totalTax = countyTax + stateTax;


//output report

cout << setprecision(2) << fixed;
cout<<endl<<endl;
cout << "Month: " << month << endl;

cout << "Year: " << year << endl;

cout << "------------------------" << endl;


cout << "Total Collected: $ " << setw(15)<<totalCollected << endl;

cout << "Sales: $ " << setw(15) <<sales << endl;

cout << "County Sales Tax: $ " << setw(15)<< countyTax << endl;

cout << "State Sales Tax: $ " << setw(15) << stateTax << endl;

cout << "Total Sales Tax: $ " << setw(15) << totalTax << endl;


return 0;
}

You might also like