0% found this document useful (0 votes)
3 views2 pages

Calculate Total with Tax Program

The document outlines a program to calculate the total purchase amount including a 7% tax. It details the input fields, constants, and intermediate fields necessary for the calculation, along with an algorithm that computes the subtotal, tax due, and total amount due. A desk check example is provided to illustrate the calculation process with specific input values.

Uploaded by

bobbysmith13212
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Calculate Total with Tax Program

The document outlines a program to calculate the total purchase amount including a 7% tax. It details the input fields, constants, and intermediate fields necessary for the calculation, along with an algorithm that computes the subtotal, tax due, and total amount due. A desk check example is provided to illustrate the calculation process with specific input values.

Uploaded by

bobbysmith13212
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

Sample:

Program to calculate purchase including tax of 7%.


Field name are descriptive and in camel case. Intermediate field is neither input nor output, but is needed in
getting the output. For instance, hours and rate are input for pay, but gross pay, taxes, etc. are needed for
determining net pay.
Pencil and paper.
sub total = number of items * price
tax due = sub total * Tax
total amount due = sub total + tax

FIELD NAME
OUTPUT Total amount due totalAmountDue

INPUT Number of items purchased numberOfItems


Price of item price

CONSTANTS Tax TAX = .07(field names


of constants always in
upper case )

INTERMEDIATE Sub total subTotal


FIELD
Tax due taxdue

Algorithm:
Input: number of items, price

Processing:
subtotal = numberOfItems * price;
taxDue = subtotal * TAX;
totalAmountDue = subtotal + taxDue;

Output; write: totalAmountDue;

Desk check:
Input: number of items-10
: price - 8

Processing:
‘from above processing
subtotal = 10* 8 = 80
taxDue = 80 * TAX(.07) =5.60
totalAmountDue = 80 + 5.60 = 85.60

Output: Write: $85.60

You might also like