c programming question?

can someone help me do this I am stuck at req- 6 question. From 6.1- 6.4

  • .

    Votes: 0 0.0%
  • .

    Votes: 0 0.0%

  • Total voters
    0

moe

Registered Member
In this assignment, you will write a simple Currency Converter using C string functions. The program can do the followings:

REQ-1. Show a Main menu, then read a digit from the keyboard. Example output:
======= MAIN ========
0 - EXIT
1 - Exchange
2 - Update Rates
3 - List Rates
4 - List Currencies
=====================
Choose from the menu:

REQ-2. If the digit is not 0-4, for example “5”, show an Error message, then show the Main menu again. Example output:

== Your input is INVALID! ==

REQ-3. If the digit is “4”, show a “Currencies” list, then show the Main menu. Example output:

===== Currencies ======
USD - US Dolloar
CAD - Canadian Dollar
EUR - Euro
GBP - British Pound
=====================

REQ-4. If the digit is “3”, show a “Rates” table, then show the Main menu. Example output:

USD CAD EUR GBP

USD 1.000 1.268 0.857 0.758

CAD 0.789 1.000 0.676 0.598

EUR 1.167 1.479 1.000 0.884

GBP 1.319 1.720 1.131 1.000

REQ-5. If the digit is “2”, show an “Update Exchange Rate” prompt, then read a line from the keyboard. Example output:

== Update Exchange Rate ==
== For Example: CAD/USD=0.789 ==
== Your Input:

5.1 If the input line is not in the required format, for example “1” or “cad”, show an Error message, and then show the “Update Exchange Rate” prompt again. Example output:

== Your input is INVALID! ==

5.2 If the input line is in the correct format of lower cases, for example “cad/usd=0.788”, show the exchange rates, then show the Main menu. Example output:

1 Canadian Dollar <==> 0.788 US Dolloar
1 US Dolloar <==> 1.269 Canadian Dollar

5.3 If the input line is in the correct format of upper cases, for example “CAD/EUR=0.677“, show the exchange rates, then show the Main menu. Example output:

1 Canadian Dollar <==> 0.677 Euro
1 Euro <==> 1.477 Canadian Dollar

5.4 Now check if the rates have been correctly updated, by giving a “3” to the Main menu (as in REQ-4 above), an updated “Rates” table should be shown. Example output:

USD CAD EUR GBP

USD 1.000 1.269 0.857 0.758






















USD CAD EUR GBP USD 1.000 1.269 0.857 0.758 CAD 0.788 1.000 0.677 0.598 EUR 1.167 1.477 1.000 0.884 GBP 1.319 1.720 1.131 1.000

REQ-6. If the digit is “1”, show a “Currency Converting” prompt, then read a line from the keyboard. Example output:

== Please let me know your question (Q to return)! ==
== Example: how much is 100 cad in usd? ==
>>

6.1 If the input line is not in the required format, for example “a”, “hello world!”, “how much is aaa cad in usd?”, or “how much is 100 cad in uuu?”, show an Error message, and then show the “Currency Converting” prompt. Example output:

== Your input is INVALID! ==

6.2 If the input line is in the correct format of lower cases, for example “how much is 100 cad in usd?”, show the exchange result, and then show the “Currency Concerting” prompt. Example output:

== 100.00 Canadian Dollar is 78.80 in US Dolloar. ==

6.3 If the input line is in the correct format of upper cases, for example “how much is 123 CAD in EUR?”, show the exchange result, and then show the “Currency Concerting” prompt. Example output:

== 123.00 Canadian Dollar is 83.27 in Euro. ==

6.4 If the input is “q” or “Q”, then show the Main menu.

REQ-7. Finally, if the digit is “0”, show a “Good-Bye” message, and then exit the program. Example output:

== Thank you, See you next time! ==
 
// there is some syntax errors, but this is what i got


#include <stdio.h>



int main()

{





int Main_Menu

{

float convert, converted;

float USD_USD =1.000, USD_CAD = 1.269, USD_EUR = 0.857, USD_GBP =0.758;

float CAD_USD=0.788, CAD_CAD=1.000, CAD_EUR =0.677, CAD_GBP=0.598;

float EUR_USD=1.167, EUR_CAD= 1.477, EUR_EUR=1.000,EUR_GBP=0.884;

float GBP_USD=1.319, GBP_CAD=1.720, GBP_EUR=1.131,GBP=1.000;

String cad2usd, cad2eur;

float cadtusd,cadteur;

int choice;

/* Display Menu System */

printf("=======MAIN=======\n\n");

printf("0. Exit\n");

printf("1. Exchange\n");

printf("2. Update Rates\n");

printf("3. List Rates\n");

printf("4. List Currencies\n\n");

printf("==================\n\n\n");

printf("Choose from the menu\n\n");

scanf("%d", &choice);

if (choice ==5)

{

printf("Your input is invalid");



}

if (choice ==4)

{

printf("====Currencies====\n\n");

printf("USD - US Dolloar\n");

printf("CAD - Canadian Dollar\n");

printf("EUR - EURO\n");

printf("GRP - Brittish Pound\n");



}

if (choice ==3)

{

printf("\n: USD CAD EUR GBP ");



printf("\n: USD: %f %f %f %f ", USD_USD,USD_CAD,USD_EUR,USD_GBP);



printf("\n: CAD: %f %f %f %f ",CAD_USD,CAD_CAD,CAD_EUR,CAD_GBP);



printf("\n: EUR: %f %f %f %f ",EUR_USD,EUR_CAD,EUR_EUR,EUR_GBP);



printf("\n: GPB: %f %f %f %f ",GBP_USD,GBP_CAD,GBP_EUR,GBP_GBP);





}

if (choice ==2)

{

printf("==Update Exchange Rate\n");

scanf( %f & CAD_USD);
printf("Exchange USD TO CAD");
scanf( %f & USD_CAD)
if (cad2usd= CAD/UDS || cad/usd)

{

cadtusd==CAD_USD;

}

scanf("%s %f",&cad2eur,&cadteur);

if (cad2eur= CAD/EUR || cad/eur)

{

cadteur==CAD_USD;

}

}

return 0;

}
 
Back
Top