I was given feed back from my instructor and I am not sure how to empliment these changes. Here is the feedback:
- In your MAIN module you call a WELCOME MESSAGE module but you don't have one defined in the code.
- Why do you have a variable named ItemName? Variable names should be descriptive
of what the are being used for.
- In your INPUT module you first ask for the items name but not for the name of
the currency you want to convert. You then ask for the currency type but input the currency amount.
- Your
PERFORM CALCULATIONS module does not perform any calculations. You do
set the sourcerate variable to different rates (but only for 4 of the
specified currencies) You never perform the currency conversion.
Currency conversion - Canadian dollars rate: 1 U.S. dollar = 1.4680 dollars)
- Mexican pesos (rate: 1 U.S. dollar = 9.5085 pesos)
- English pounds (rate: 1.6433 U.S. dollars = 1 pound)
- Japanese yen (rate: 1 U.S. dollar = 104.9200 yen)
- French francs (rate: 1 U.S. dollar = 6.2561 francs)
Currency Conversion Design
Main module
Declare ItemName As String
Declare Currency type As Real
Call Welcome message module
Call Input Data module
Call Perform Calculations module
Call Output Results module
Write “Welcome to the currency convertor database,”
End Program
Input Data module
Write “Enter the item’s name?”
Input ItemName
Write “What is the currency type?”
Input currency dollar amount
End Input Data module
Perform Calculations module
If sourceCurrency is Dollar Then
Assign sourceRate to 1.4680 dollars
ElseIf sourceCurrency is Pound Then
Assign sourceRate to 1.6433 Pounds
ElseIf sourceCurrency is Yen Then
Assign sourceRate to 104.9200 yen
ElseIf sourceCurrency is Francs Then
Assign sourceRate to 6.2561 francs
End If
Output Results module
Write “The currency is”: ItemName
Scott LyslePosted Dec 19, 2008, 11:48 PM
As the instructor said, you call the welcome message module but there isn't one. You need to define a module named WelcomeMessage and have it perform the action of writing out the welcome message.
of what the are being used for.
Here you need two variables, the amount of US currency that you need to convert to foreign currency and the name of the type of currency you wish to convert it into. At that, he is saying that you need to name your variables something that will make sense to someone else that might come along later and maintain your code. I suppose that using something like DollarsToConvert as decimal and ConversionCurrency as string would work.
the currency you want to convert. You then ask for the currency type but input the currency amount.
After renaming your variables, this ought to make more sense. If you ask for the amount of US currency to convert and assign the value to the DollarsToConvert variable, and then ask for the conversion currency and assign it to the ConversionCurrency variable, you will have accomplished that.
The perform calculations module does not calculate the value of the foreign currency. If you switch on the currency type and then convert the currency by multiplying the DollarsToConvert by the conversion factor, you will have calculated the value of the foreign currency after converting US dollars to yen or pesos or whatever.