Your Software Company Was Invited To Provide A Proposal

Your Software Company Was Invited To Provide A Proposal For A Company

Your software company was invited to provide a proposal for a company in Australia. You currently have the cost in US dollars and need to convert the prices to the Australian dollar. Write a 2-part program using Ruby, Java®, or Python. Part 1: Write a function to gather the following costs from the user: Travel Cost: $9,800 Hotel Cost: $3,500 Rental Car Cost: $1,600 Labor Cost: $15,500 Part 2: Write a function to convert the costs from United States dollar (USD) to Australian dollar (AUD). Note : Look up the current USD to AUD exchange rate to use in your function. Test the program 3 times by providing different costs in USD. Provide the code and take a screenshot of the output, then paste the screenshot(s) into a Microsoft® Word document. Write a half-page response in the same Microsoft® Word document to address the following: Provide a manual for the user explaining how to use the program. Explain what type of user input validations you should have. What happens if the user enters a negative number? What happens if the user puts a $ in the input? Submit your document.

Paper For Above instruction

Your Software Company Was Invited To Provide A Proposal For A Company

Python program to gather costs and convert USD to AUD

This paper presents a Python program designed to assist a software company in preparing a proposal for an Australian client by calculating and converting costs from USD to AUD. The program is divided into two main parts: data collection and currency conversion. It operates interactively, prompting the user for specific cost inputs and then converting these costs based on the latest exchange rate. The following sections detail the implementation, testing, user manual, validation strategies, and handling of erroneous inputs.

Introduction

In international business, accurately converting costs from one currency to another is essential for financial planning and proposal accuracy. The presented program facilitates this by providing a simple, user-friendly interface for inputting costs and obtaining their Australian dollar equivalents. The program's modular design ensures clarity and ease of maintenance, with functions dedicated to data input and currency conversion.

Implementation of the Program

Part 1: Data Collection

The first part involves defining a function, collect_costs(), which prompts the user for four cost components: Travel, Hotel, Rental Car, and Labor costs. To ensure data integrity, input validation is integrated within this function. Each input is checked to confirm it is a positive numerical value; if not, the program requests re-entry until valid data is received.

Part 2: Currency Conversion

The second part introduces the convert_usd_to_aud() function, which accepts a USD amount and converts it to AUD using a fixed exchange rate. As of the current date, the exchange rate is approximately 1 USD = 1.50 AUD. In a real-world scenario, this rate can be fetched dynamically from an API, but for this example, a static rate suffices. This function returns the converted amount.

Code Implementation

def collect_costs():

costs = {}

prompts = {

'Travel Cost': 9800,

'Hotel Cost': 3500,

'Rental Car Cost': 1600,

'Labor Cost': 15500

}

for key, default in prompts.items():

while True:

try:

user_input = input(f"Enter {key} in USD (default {default}): ")

if user_input.strip() == '':

amount = default

else:

amount = float(user_input)

if amount

print("Please enter a positive value.")

continue

costs[key] = amount

break

except ValueError:

print("Invalid input. Please enter a numerical value.")

return costs

def convert_usd_to_aud(amount_usd):

exchange_rate = 1.50 # Example exchange rate

return amount_usd * exchange_rate

Test the program three times with different values

for i in range(3):

print(f"\n--- Test Run {i+1} ---")

costs_usd = collect_costs()

print("\nConverted Costs in AUD:")

total_aud = 0

for item, usd_value in costs_usd.items():

aud_value = convert_usd_to_aud(usd_value)

total_aud += aud_value

print(f"{item}: USD {usd_value} = AUD {aud_value:.2f}")

print(f"Total Cost in AUD: {total_aud:.2f}")

User Manual and Input Validation

To operate the program, the user is prompted sequentially to enter costs for travel, hotel, rental car, and labor. The user can accept default values by pressing Enter or input custom amounts. The program enforces input validation rules: only positive numerical values are accepted. If the user inputs a negative number, the program displays an error message and prompts again. If the user inputs a non-numeric value, such as a letter or special character, an error message appears, asking for correct input. Incorporating these validations prevents incorrect data entry and ensures accurate conversion.

Handling Erroneous Inputs

If the user enters a negative number, the program rejects the input and requests re-entry, thereby preventing invalid data from affecting calculations. When a user includes a dollar sign ($) or other symbols in the input, the program's float conversion will raise a ValueError, and the validation code will prompt the user again. To enhance robustness, the input processing can strip non-numeric symbols before conversion, but currently, explicit error handling ensures only valid numerical inputs are accepted.

Conclusion

This Python program effectively collects different cost components and converts them from USD to AUD, facilitating international proposal preparation. Proper input validation enhances usability and accuracy. Future improvements could include dynamic exchange rate fetching and additional currency options, making the tool more versatile for global financial tasks.

References

  • U.S. Federal Reserve. (2023). Federal Reserve Economic Data. https://fred.stlouisfed.org/
  • OECD. (2023). Exchange rates and international finance. https://www.oecd.org/
  • Python Software Foundation. (2023). Python documentation. https://docs.python.org/3/
  • Investopedia. (2023). Currency conversion and exchange rates. https://www.investopedia.com/
  • XE.com. (2023). Live currency exchange rates. https://www.xe.com/
  • Bloomberg. (2023). Financial market data. https://www.bloomberg.com/markets
  • Australian Bureau of Statistics. (2023). Currency exchange rates. https://www.abs.gov.au/
  • World Bank. (2023). Global economic prospects. https://www.worldbank.org/
  • Stack Overflow. (2023). Handling user input validation in Python. https://stackoverflow.com/
  • Real Python. (2023). Building user-friendly command-line interfaces. https://realpython.com/