Question: You are provided with a partially completed program. This program asks the user for a dollar amount. It computes the tax on that amount and
You are provided with a partially completed program. This program asks the user for a dollar amount. It computes the tax on that amount and final price.
Complete the def pricetoint(text) function. This function will take a string as input. The string has the following properties:

You are provided with a partially completed program. This program asks the user for a dollar amount. It computes the tax on that amount and final price Complete the def pricetoint(text) function. This function will take a string as input. The string has the following properties Includes characters 0-9 May include period to denote cents. (If not included assume O cents.) May include $sign May include commas as digit separators Your function will convert the string into a floating point number. You may not use any built in commands like int or float. You must solve this problem my analyzing the characters in the string of text. If the input is invalid, return -1 as the function's result Your code should match the below execution trace Determine Price with Tax. Enter 'exit' at any time to quit. Enter Amount ($X, XXX. XX): 100.00 Amount: 100.0 Tax: 6.0 Price w Tax: 106.0 Enter Amount ($X, XXX.XX): 200 Amount: 200 Tax: 12.0 Price w/ Tax: 212.0 Enter Amount ($X, XXX.XX): 98.78 Amount: 98.78 Tax: 5.93 Price w Tax: 104.71 Enter Amount ($X, XXX.XX): $1,009.78 Amount: 1009.78 Tax: 60.59 w TaX: 1070.37 You are provided with a partially completed program. This program asks the user for a dollar amount. It computes the tax on that amount and final price Complete the def pricetoint(text) function. This function will take a string as input. The string has the following properties Includes characters 0-9 May include period to denote cents. (If not included assume O cents.) May include $sign May include commas as digit separators Your function will convert the string into a floating point number. You may not use any built in commands like int or float. You must solve this problem my analyzing the characters in the string of text. If the input is invalid, return -1 as the function's result Your code should match the below execution trace Determine Price with Tax. Enter 'exit' at any time to quit. Enter Amount ($X, XXX. XX): 100.00 Amount: 100.0 Tax: 6.0 Price w Tax: 106.0 Enter Amount ($X, XXX.XX): 200 Amount: 200 Tax: 12.0 Price w/ Tax: 212.0 Enter Amount ($X, XXX.XX): 98.78 Amount: 98.78 Tax: 5.93 Price w Tax: 104.71 Enter Amount ($X, XXX.XX): $1,009.78 Amount: 1009.78 Tax: 60.59 w TaX: 1070.37
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
