|
||||||
| General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hi,
I need some input on an assignment I am doing. I am not sure if I even did this assignment right or not. So any help would be appreciated. My assignment is to generate a test input based on the Currency Conversion program. 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) Here is my Test inputs based on the currency above. 1. Input 146.8 Canadian dollars and the result should come out as 100 U.S. 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. • To check 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. • For the last part 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 |
| Sponsored Links |
|
|
|
|||||
|
You might want to test that the inputed values are integers not letters. I know in Java the program will terminate if the program is expecting an integer and gets passed a letter.
And if you want to have a look, this is what I came up with for a GUI based Java Currency Conversion program. need help on class project |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| China 2nd Grade test | Void | The Lounge | 23 | 02-14-2008 07:30 PM |
| Java Test - 1 | xXHalfSliceXx | Java Help | 8 | 01-08-2007 08:24 PM |
| eBay to test advertising auctions on other sites | NeedHelp | The Lounge | 5 | 08-07-2006 09:57 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 98%