Computer Science Homework Solutions
Problem
#97405

Generate a set of test inputs and expected results for this Currency Conversion program

Generate a set of test inputs and expected results for this Currency Conversion program. See attached file for full problem description.

Attached file(s):
Attachments
Test inputs.doc  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

Test inputs.doc
Please generate a set of test inputs and expected results for this
Currency Conversion program below. As an example, I have below (in RED),
a similar example.

I need the answers in table form:

Test Values

Input Expected Output Comments



















































































































 

#include

#include

#include

#include

void displayTitle(){

printf("\nU.S. Dollar Currency Converter\n");

printf("\nThis will allow user to convert any of the listed\n");

printf("currencies to a US Dollar amount of your choice.\n");

}

void displayMenu(){

printf("\nWhat country would you like to convert your money to?
(1-5):\n");

printf("Press [1] for Canadian Dollar\n");

printf("Press [2] for Australian Dollar\n");

printf("Press [3] for British Pound\n");

printf("Press [4] for Euro\n");

printf("Press [5] for Japanese Yen\n");

printf("Press [6] to Exit\n");

}

void Menu(){

/* Data Declaration and initialization*/

int Curr_type;

float For_curr=0.0;

float Equ_curr=0.0;

char choice;

do {

displayTitle();

displayMenu();

scanf("%d", &Curr_type);

/*Checking if user wants to quit*/

if (Curr_type==6){

//Confirm Quit: Confirming further that the user wants to quit

do{

printf("Confirm Q for Quit or R to Return to Menu\n");

scanf(" %c",&choice);

if (choice == 'Q' || choice == 'q')

exit(0);

//Changed Mind? Returning to the Menu()

else if (choice == 'R' || choice == 'r')

Menu();

//Again, pressed the wrong button, Give him another chance

else choice = 'X'; /*Wrong choice so repeat the same question*/

}while(choice == 'X'); //end Do..While

} /*Ends Quit Confirmation */



//Display Error Message for Invalid input

if (Curr_type <1||Curr_type>5)

printf("There is an error in input\n");

} while (Curr_type<1||Curr_type>5); //Checking Legal Input

do{

printf("\nEnter the amount that you\n");

printf("would like to convert to USD:\n");

scanf("%f", &For_curr);

//Display Error Message for Invalid input

if (For_curr <=0.0)

printf("There is an error in input\n");

}while (For_curr<=0.0); //Checking Valid Input/Amount



switch(Curr_type)

{

case 1:

Equ_curr = For_curr * 1/1.11950;

printf ("The equivalent USD for %f of CAD is %1.2f", For_curr,
Equ_curr);

break;

case 2:

Equ_curr = For_curr * 1/1.32275;

printf ("The equivalent USD for %f of ASU is %1.2f", For_curr,
Equ_curr);

break;

case 3:

Equ_curr = For_curr * 1/0.532311;

printf ("The equivalent USD for %f of BRP is %1.2f", For_curr,
Equ_curr);

break;

case 4:

Equ_curr = For_curr * 1/0.791050;

printf ("The equivalent USD for %f of EUR is %1.2f", For_curr,
Equ_curr);

break;

case 5:

Equ_curr = For_curr * 1/117.880;

printf ("The equivalent USD for %f of YEN is %1.2f", For_curr,
Equ_curr);

break;

/*Other: Currency of any other country */

default:

printf("Error: This system doesn't support conversion for this
currency\n");

break;

} /*end switch */

} /*End Menu()*/

main ()

{



Menu();

getchar();

} /*end main*/

 

Test Values

Input Expected Output Comments

Salary = 0.0 Error Message

Salary = 0.0

Taxes = 0.0 input out of valid range

Salary = 15000.00 Error Message

Salary = 0.0

Taxes = 0.0 input out of valid range

Salary = 0.01 Salary = 0.01

Taxes = 0.0015 lower limit of first tax interval

Salary = 1000.00 Salary = 1000.00

Taxes = 150 middle of first tax interval

Salary = 1499.99 Salary = 1499.00

Taxes = 225.00 upper limit of first tax interval

Salary =1500.01 Salary = 1500.01

Taxes = 225.00 lower limit of second tax interval

Salary = 2000.00 Salary = 2000.00

Taxes = 305.00 middle of second tax interval

Salary = 2999.99 Salary = 2999.00

Taxes = 465.00 upper limit of second tax interval

Salary =3000.01 Salary = 3000.01

Taxes = 465.00 lower limit of third tax interval

Salary = 4000.00 Salary = 4000.00

Taxes = 645.00 middle of third tax interval

Salary = 4999.99 Salary = 4999.00

Taxes = 825.00 upper limit of third tax interval

Salary =5000.01 Salary = 5000.01

Taxes = 825.01 lower limit of fourth tax interval

Salary = 6000.00 Salary = 6000.00

Taxes = 1025.00 middle of fourth tax interval

Salary = 7999.99 Salary = 7999.00

Taxes = 1425.00 upper limit of fourth tax interval

Salary =8000.01 Salary = 8000.01

Taxes = 825.01 lower limit of fifth tax interval

Salary = 12000.00 Salary = 12000.00

Taxes = 2425.00 middle of fifth tax interval

Salary = 14999.99 Salary = 14999.00

Taxes = 3175.00 upper limit of fifth tax interval

 

Pseudocode

Main program

 

Declare salary as real

Declare taxes as real

Call Get Salary Module

Call Calculate Taxes Module

Call Output Taxes Module

 

End main module

 

Get Salary

 

Print “Enter the Salary:“

Get Salary

 

Get Salary

 

Calculate Salary

 

Declare Base_Tax as real

Declare Excess as real

Declare Rate as real

if(Salary <= 0 OR Salary >= 15000.00)

Display “Invalid Salary”

Set Base_Tax = 0.0

Set Rate = 0.0

Set Excess = 0.0

else if(Salary <= 1499.99)

Set Base_Tax = 0.0

Set Rate = .15

Set Excess = Salary

else if(Salary <= 2999.99)

Set Base_Tax = 225.00

Set Rate = .16

Set Excess = Salary – 1500.00

else if(Salary <= 4999.99)

Set Base_Tax = 465.00

Set Rate = .18

Set Excess = Salary – 3000.00

else if(Salary <= 7999.99)

Set Base_Tax = 825.00

Set Rate = .20

Set Excess = Salary – 5000.00

else (Salary <= 14999.99)

Set Base_Tax = 1465.00

Set Rate = .25

Set Excess = Salary – 8000.00

end if

Set taxes = Base_Tax + (Excess*Rate)

End Calculate_Taxes

 

Output Taxes

 

Display “Salary = $“, Salary, “taxes = $”, Taxes

Display “Welcome to the world of the progressive tax system”

 

End Output Taxes

Solution Summary

Generates a set of test inputs and expected results for this Currency Conversion program

Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$27.93)
Included in Download
  • Plain text response
  • Attached file(s):
    • Test inputs of program 97405.zip
$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
  • Test inputs - Generate a set of test inputs and expected results for the Currency Conversion program.
  • Writing a Narrative Program: Example Currency Conversion - Using the C compiler, write a C program that contains your narrative from broken down into one line sentences, that have been commented out. Write English narrative that converts currency. The ...
  • Write a menu based currency conversion program in C - Currency conversion program . The user will input the amount and type of currency (1-5) and the program outputs the equivalent amount in USD. Need help with: 1.code that will limit type of curren ...
  • Currency Conversion - Consolidate all the sections of the Currency Conversion development documentation: requirements, design, and testing. This applicationsimilar to simple, practical programs on many travel or fina ...
  • Miracle C compiler problem in compiling currency conversion program - I ran the previous problem but still got errors maybe it is the compiler we have to use which is Miracle C. This is the error that I have. unrecognised types in comparison 'while (Amount<=0)' ( ...
Browse