Test input

Not sure if I did this right any feedback would be appreciated.

Page 1 of 1

1 Replies - 3130 Views - Last Post: 29 March 2007 - 07:14 PM Rate Topic: -----

#1 patience  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-March 07

Test input

Posted 17 March 2007 - 12:31 AM

International currency type

• Canadian dollars (rate: 1 U.S. dollar = 1.4680 Canadian dollars)
• Mexican Peso (rate: 1 U.S. dollar = 9.5085 pesos)
• English Pounds (rate: 1.6433 dollars = 1 pound)
• Japanese Yen (rate: 1 U.S. dollar = 104.9200 yen)
• French francs (rate: 1 U.S. dollar = 6.2561 francs)




Test inputs base on the currency type above.

I first:

1. Input 146.8 Canadian dollars and the result should come out as 100 US dollars.
2. Input 950.85 and the result should be 100 US dollars also
3. Input 100 pounds and the result should be 164.33 US dollars.
4. Input 10492 yen and the result should be 100 US dollars.
5. Input 625.61 francs and the result should also be 100 US dollars.


• After checking that the calculations are correct, I would also need to input 0 and 2,100,000 to see if the error message works. It should say, “Error invalid amount”.
• I would input a 6 in the choose currency type and it should display, “Exiting conversion program.
• Lastly I would enter 7 in the choose currency type and it should display, “Error: Invalid amount”.


Main Module

Declare currency amount as integer
Declare currencytype as integer
Declare Othercountryvalue as real
Declare USAValue as real
Do While user continues
   Display menu
   Get Othercountryvalue
   Convert currency
   Display results
End loop
Print exit message
 
End Main Module
 
Display Menu
 
Set continue = true
While continue = true
Display “Welcome to the foreign currency conversion program”
Display “Choose a currency to convert”
Display “Foreign currency types”
Display “1: Canadian dollars”
Display “2: Mexican pesos”
Display “3: English pounds”
Display “4: Japanese yen”
Display “5: French francs”
Display “6: Quit program”
Display “Choose a currency type”
 
Input currencytype
If currencytype >= 1 and currencytype <= 5 then
   Set continue = false
else if currencytype = 6
   Display “Exiting conversion program”
   Continue = false
Else
   Display “Error: This choice does not exist”
   Continue = true
end if
end while
 
End Display Menu
 
Get Othercountryvalue
 
Declare value as integer
Declare continue as real
Set continue = true
While continue = true
   Display “Enter currency amount:”
   Input othercountryvalue
If othercountryvalue > 0 and othercountryvalue <= 2000000 then
Continue = false
   else
   Display “Error: Invalid amount”
   Continue = true
end if
end while
 
End get othercountryvalue
 
Convert currency amount
 
Declare rate as real
Select choice of currencytype
   choice 1:
	  Set rate = 1.4680
   choise 2: 
	  Set rate = 9.5085
   choice 3:
	  Set rate = .6085
   choice 4:
	  Set rate = 104.9200
   choice 5: 
	  Set rate = 6.2561
   default:
	  Set rate = 0
 
End Convert Currency
 
Output Currency Results
 
Declare country as string
Declare currency as string
Select choice of currencytype
   choice Canadian:
	  country = “Canadian”
	  currency = “Dollars”
   choice Mexican:
	  country = “Mexican”
	  currency = “Pesos”
   choice English:
	  country = “English”
	  currency = “Pounds”
   choice Japanese:
	  country = “Japanese”
	  currency = “Yen”
   choice French:
	  country = “French”
	  currency = “Francs”
   default:
	  country = “No country”
	 currency = “0”
End choice
if currency <>”” then
   Display “Your currency value:” othercountryvalue, “”, country,””,currency, “is”,
   USAValue, “dollars”
else
Display “Error: Incorrect type of currency.”
end if
 
End Output Currency Results


Is This A Good Question/Topic? 0
  • +

Replies To: Test input

#2 dedman  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 52
  • Joined: 22-April 05

Re: Test input

Posted 29 March 2007 - 07:14 PM

This is the only thing I found:

"Declare continue as real"

I think you meant "Declare othercountryvalue as real", but you already declared that at the beginning, so maybe you meant "Declare continue as boolean (or bool)". If so, you should have that at the top too because you use continue at the very beginning.

Hope it helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1