Computers and Technology, 20.03.2020 01:25, cavapoo
This problem is about Python modules.
Crate a module currency, which includes the following three functions that do currency conversions:
to_euro(dollar): This function receives US Dollar as an argument and converts it to Euro. 1 US Dollar = 0.81 Euro. Return Euro.
to_yen(dollar): This function receives US Dollar as an argument and converts it to Japanese Yen. 1 US Dollar = 106.45 Yen. Return Yen.
to_peso(dollar): This function receives US Dollar as an argument and converts it to Mexican Peso. 1 US Dollar = 18.58 Peso. Return Peso.
Store these three functions in a file named currency. py.
Create a file for the main module. Name the file lab12P2.py.
Define a main function in the main module to do the following:
Ask the user to choose a foreign currency: Euro, Japanese Yen or Mexican Peso.
Write a loop to validate user input. If an invalid choice is made, display an error message and ask the user to choose a foreign currency again until the choice is valid.
Ask the user to enter US dollar amount. Write a loop to validate user input. If the US dollar amount is negative, display an error message and ask the user to reenter it until it is non-negative.
Call one of the three functions in the currency module to convert US dollar to the foreign currency chosen by the user
Receive and display the converted foreign currency
The following is an example.
Converting US Dollar to a foreign currency.
Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: 4
Error: Invalid Choice
Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: 5
Error: Invalid Choice
Enter 1 for Euro, 2 for Japanese Yen, 3 for Mexican Peso: 2
Enter US Dollar: -100
Error: US Dollar cannot be negative.
Enter US Dollar: -200
Error: US Dollar cannot be negative.
Enter US Dollar: 100
It is converted to 10645.0 Yen
Answers: 1
Computers and Technology, 22.06.2019 09:40, cutybrain6054
Sarah is having a hard time finding a template for her advertising business that she may be able to use at a later date and also make it available to her colleagues
Answers: 1
Computers and Technology, 22.06.2019 19:50, rosyposy43
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called. write a constructor for the above class that initialized both variables to zero. write a tostring to display both the tank and speed when the car is printed. modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter. write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
Computers and Technology, 22.06.2019 21:00, daniella0123
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
Computers and Technology, 22.06.2019 22:40, Bgreene2377
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
This problem is about Python modules.
Crate a module currency, which includes the follow...
Crate a module currency, which includes the follow...
Spanish, 20.09.2020 15:01
Mathematics, 20.09.2020 15:01
Mathematics, 20.09.2020 15:01
English, 20.09.2020 15:01