Computer Science Homework Solutions
Problem
#94725

How to generate a set of input test values from a code

I am asked to generate a set of INPUT TEST VALUES. Is that included into this control structure, or do I have to create a whole different set of variables?

(if you have to create an extended set of variables please return posting so I can add more credits.)

Declared Variables

Input: salary in real
Output: tax in real
Other: baseTax in real, minimum in real, Excess in real

Control Structure: if-then-else (dual alternative)

Method Taxation:
Begin
If salary is negative exit with error

If salary <= 1499.99 then
Minimum = 0
baseTax = 0
Excess = 0.15
tax = calculateTax(minimum, baseTax, Excess, salary)

Else If salary <= 2999.99 then
Minimum = 1500
baseTax = 225
Excess = 0.16
tax = calculateTax(minimum, baseTax, Excess, salary)

Else If salary <= 4999.99 then
Minimum = 3000
baseTax = 465
Excess = 0.18
tax = calculateTax(minimum, baseTax, Excess, salary)

Else If salary <= 7999.99 then
Minimum = 5000
baseTax = 825
Excess = 0.20
tax = calculateTax(minimum, baseTax, Excess, salary)

Else If salary <= 14999.99 then
Minimum = 8000
baseTax = 1425
Excess = 0.25
tax = calculateTax(minimum, baseTax, Excess, salary)

showTax()

End Taxation

Subroutine calculateTax:
calculateTax(baseTax, salary)
Begin
Tax = baseTax + (salary – minimum) * Excess
Return Tax
End calculateTax

Subroutine showTax:
showTax()
Begin
Print “The Tax amount is ”, tax
End


Solution Summary

Shows using an example pseudo code applicable to any high level language

Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$7.98)
Included in Download
  • Plain text response
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Data Structures C++ - You should post the "best possible" responses to the question. Remember that the main purpose of algorithm questions is to come up with the best possible algorithms through discussion. It is ok to wri ...
  • Please answer the following - You have just been hired as the testing guru for the CatchAllBugs.com Company. Your first task is to write a set of test cases to debug a small VB program. Unfortunately, you do not have access to th ...
  • Variables, prompts, and output. - START Declare TestScore as integer Write "Enter your Test Score and Your Grade will be Displayed" INPUT Test Score If TestScore>90 Write "Your Grade is an A" Else IF TestScore>80 Write "You ...
  • Right angle - Design 10 test cases and explain the purpose of each of them. The purpose is one to two sentences. For example the purpose of (3,4,5) is to test that the program correctly identifies a right angle (9+ ...
  • Use pseudo-code to write the ATM machine and then design the test cases - Read the article: Test Infected: Programmers Love Writing Tests at http://junit.sourceforge.net/doc/testinfected/testing.htm. Now assume that one has to design an ATM machine object using Java (C or C ...
Browse