Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
10. Write a function curconv() that takes as input:
1. a currency represented using a string (e.g., 'JPY' for the Japanese Yen or 'EUR'
for the Euro)
2. an amount
and then converts and returns the amount in US dollars.
>>> curconv('EUR', 100)
122.96544
>>> curconv('JPY', 100)
1.241401
The currency rates you will need are stored in file currencies.txt:
AUD 1.0345157 Australian Dollar
CHF 1.0237414 Swiss Franc
CNY 0.1550176 Chinese Yuan
DKK 0.1651442 Danish Krone
EUR 1.2296544 Euro
GBP 1.5550989 British Pound
HKD 0.1270207 Hong Kong Dollar
INR 0.0177643 Indian Rupee
JPY 0.01241401 Japanese Yen
MXN 0.0751848 Mexican Peso
MYR 0.3145411 Malaysian Ringgit
NOK 0.1677063 Norwegian Krone
NZD 0.8003591 New Zealand Dollar
PHP 0.0233234 Philippine Peso
SEK 0.148269 Swedish Krona
SGD 0.788871 Singapore Dollar
THB 0.0313789 Thai Baht
for the Euro)
2. an amount
and then converts and returns the amount in US dollars.
>>> curconv('EUR', 100)
122.96544
>>> curconv('JPY', 100)
1.241401
The currency rates you will need are stored in file currencies.txt:
AUD 1.0345157 Australian Dollar
CHF 1.0237414 Swiss Franc
CNY 0.1550176 Chinese Yuan
DKK 0.1651442 Danish Krone
EUR 1.2296544 Euro
GBP 1.5550989 British Pound
HKD 0.1270207 Hong Kong Dollar
INR 0.0177643 Indian Rupee
JPY 0.01241401 Japanese Yen
MXN 0.0751848 Mexican Peso
MYR 0.3145411 Malaysian Ringgit
NOK 0.1677063 Norwegian Krone
NZD 0.8003591 New Zealand Dollar
PHP 0.0233234 Philippine Peso
SEK 0.148269 Swedish Krona
SGD 0.788871 Singapore Dollar
THB 0.0313789 Thai Baht
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- The food pantry provides its volunteers with keys to unlock doors and a Food Pantry vest to let customers know they work there. There are a limited amount of keys and vests, so volunteers need to check them out of the office.Complete the program by creating a CheckoutEquipment function that takes in the number of keys and vests currently available at the office. If there are enough keys and vests, the function should reduce the number of keys and vests by 1 and return true. Otherwise, the number of keys and vests will stay the same, and the function will return false. Take note that the number of keys and vests will be defined in the main function and the CheckoutEquipment function should modify the values of those variables declared in main. #include <iostream> int main() { int keys = 10; int vests = 10; bool checked_out = CheckoutEquipment(keys, vests); if (checked_out) { std::cout << "Successfully checked out.\n"; } else { std::cout << "Not…arrow_forwardWrite a function for the Superman ride at Six Flags that determines whether the user is taller than 4'8" so that he or she can ride a roller coasterarrow_forwardWrite a function convertQuartersToDollars that has the noOfQuarters, noOfDollars, and remainingCents as formal parameters of data type int. The noOfQuarters is the number of quarters to be used to calculate noOfDollars, the number of dollars that the total number of quarters can be converted to, and remainingCents , the remaining cents. The noOfDollars and remainingCents are returned from the function,arrow_forward
- In C, write a function that gets two ints a and b. If a>b the function returns a^3 + b^2, and otherwise it returns a^2 + b^3. int square_cube (int a, int b); For example: square_cube (1,2) should return 1 + 8 = 9. square_cube (10, 3) should return 1000 + 9 = 1009. square_cube (2, -1) should return 8 + 1 = 9. square_cube (-2, -1) should return 4 - 1 = 3.arrow_forwardWhich of the following is a correct and complete function definition? a. double funct(double x) { return 2*x; } b. double funct(Int x) { return (x-3); } c. int funct (x) { return (++x); } d. int funct (int x); e. void funct(x=7) { return 8; } f. void funct(int x=7) { return x/3; }arrow_forward3. Experiment with the following code for different strings assigned to s: S = # yourstring goes here for c in s: if c.isupper () : print (c) 4. Write a function upper that behaves as follows, i.e. it returns the substring of capitalized letters.arrow_forward
- Create the function prototype of a function called send that accepts a single String parameter called name with the argument label to. It should return a Bool value. *Note: The function prototype only provides the name, parameters, and return type of a function. You can also think of it as the function without the body (curly braces and anything inside it.)arrow_forwardDefine a function `is_minor` that takes _age_ as an argument and returns `True` if age is below 21, `False` otherwise. The function should `raise` a `ValueError` if the provided argument is not a number (either integer or float).arrow_forward7. Write a function password_check() that takes as input two stringsnewpassword and oldpassword, and that accepts the new password (i.e., returnsTrue) if newpassword is different from oldpassword and newpassword is atleast 6 letters long. If the new password fails the check, your functions should returnFalse.>>> password_check('E10-s2ff', 'E10.s2ff')True>>> password_check('E10sf', 'E10.s2ff')False>>> password_check('E10-s2ff', 'E10-s2ff')False(Extra Credit) For extra credit, extend your password function so that it also checks thatthe new password contains a digit.>>> password_check('E10-s2ff', 'E10.s2ff') True>>> password_check('Eej-sdff', 'E10.s2ff')Falsearrow_forward
- Write a function definition for a function named getLast that does the following 1) Accepts an string as an input parameter 2) Returns the last character in the string. Example Given the string "Helle" this function returns o.arrow_forwardA function that turns an argument to a string (call it “toString(…)”) is a great use of function overloading. In one sentence, why might this be? In one sentence, why should we generally verify the arguments are what we expect when writing a function?arrow_forwardin c programing with User-Defined Functions Remove all non-alphabetic characters Write a program that removes all non-alphabetic characters from the given input. Assume the input string will not exceed 50 characters. Ex: If the input is: -Hello, 1 world$! the output is: Helloworld The program must define and call a function named RemoveNonAlpha that takes two strings as parameters: userString and userStringAlphaOnly. userString is the user specified string from the program input. Function RemoveNonAlpha() then assigns userStringAlphaOnly with the user specified string without any non-alphabetic characters.void RemoveNonAlpha(char userString[], char userStringAlphaOnly[])arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education