fstringFIXED
docx
keyboard_arrow_up
School
Florida Atlantic University *
*We aren’t endorsed by this school
Course
COP3450
Subject
Finance
Date
Jan 9, 2024
Type
docx
Pages
5
Uploaded by AgentAnteaterPerson953
F-Strings Lab
Create the following programs using f-strings:
o
Create a program that will calculate a user's sales tax of a sale in Florida.
def calculate_sales_tax
(
sale_amount
,
tax_rate
):
sales_tax
=
sale_amount
*
tax_rate
total_amount
=
sale_amount
+
sales_tax
return
sales_tax
,
total_amount
# Standard sales tax rate in Florida (7%)
florida_sales_tax_rate
=
0.07
# Get the sale amount from the user
while True
:
try
:
sale_amount
= float(input(
"amount: $250"
))
break
except
ValueError
:
print(
"250."
)
# Calculate the sales tax and total amount
sales_tax
,
total_amount
=
calculate_sales_tax
(
sale_amount
,
florida_sales_tax_rate
)
# Display the results
print(
f
"Sales Tax: ${sales_tax:.2f}"
)
print(
f
"Total Amount (including tax): ${total_amount:.2f}"
)
Create a program that will run a multiplication expression and round the answer to
the nearest 2 decimal places, with comma separators.
import
locale
def multiply_and_round
(
num1
,
num2
):
result
=
num1
*
num2
rounded_result
= round(
result
,
2
)
return
rounded_result
# Set locale to get comma separators
locale
.
setlocale
(
locale
.
LC_NUMERIC
,
'en_US.UTF-8'
)
# Get user input for two numbers
while True
:
try
:
num1
= float(input(
"24: "
))
num2
= float(input(
"18: "
))
break
except
ValueError
:
print(
"26."
)
# Calculate the result
result
=
multiply_and_round
(
num1
,
num2
)
# Format the result with comma separators and 2 decimal places
formatted_result
=
locale
.
format
(
'%.2f'
,
result
,
grouping
=
True
)
# Display the result
print(
"The result of the multiplication is:"
,
formatted_result
)
Calculate someone’s age in days with the output including comma separators
import
locale
from
datetime
import
datetime
def calculate_age_in_days
(
birthdate
):
today
=
datetime
.
now
()
age_in_days
= (
today
-
birthdate
).
days
return
age_in_days
# Set locale to get comma separators
locale
.
setlocale
(
locale
.
LC_NUMERIC
,
'en_US.UTF-8'
)
# Get user input for birthdate
while True
:
try
:
birthdate_str
= input(
" (2005-12-17): "
)
birthdate
=
datetime
.
strptime
(
birthdate_str
,
"%Y-%m-%d"
)
break
except
ValueError
:
print(
" 2005-12-17."
)
# Calculate the age in days
age_in_days
=
calculate_age_in_days
(
birthdate
)
# Format the age in days with comma separators
formatted_age_in_days
=
locale
.
format_string
(
'%d'
,
age_in_days
,
grouping
=
True
)
# Display the age in days
print(
"Your age in days is:"
,
formatted_age_in_days
)
Create a program that will calculate the net salary of a user's input in America.
import
locale
def calculate_net_salary
(
gross_salary
,
federal_tax_rate
,
state_tax_rate
):
federal_tax
=
gross_salary
*
federal_tax_rate
state_tax
=
gross_salary
*
state_tax_rate
total_taxes
=
federal_tax
+
state_tax
net_salary
=
gross_salary
-
total_taxes
return
net_salary
# Set locale to get comma separators
locale
.
setlocale
(
locale
.
LC_NUMERIC
,
'en_US.UTF-8'
)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
# Get user input for gross salary, federal tax rate, state tax rate, and additional
deductions
while True
:
try
:
gross_salary
= float(input(
"10,00,000 $"
))
federal_tax_rate
= float(input(
" (0.7): "
))
state_tax_rate
= float(input(
" (0.07): "
))
break
except
ValueError
:
print(
"10,000,000."
)
# Calculate the net salary
net_salary
=
calculate_net_salary
(
gross_salary
,
federal_tax_rate
,
state_tax_rate
)
# Format the net salary with comma separators
formatted_net_salary
=
locale
.
format
(
'%.2f'
,
net_salary
,
grouping
=
True
)
# Display the net salary
print(
"Your net salary is: $"
+
formatted_net_salary
)
Create a program that will output a percentage
ef format_as_percentage
(
value
):
formatted_percentage
=
"{:.2%}"
.
format
(
value
)
return
formatted_percentage
# Placeholder value for demonstration
percentage_value
=
0.25
# Output the percentage
formatted_percentage
=
format_as_percentage
(
percentage_value
)
print(
"The percentage is:"
,
formatted_percentage
)
Create a program that will output an integer with comma separators
import
locale
def format_with_commas
(
number
):
formatted_number
=
locale
.
format_string
(
'{:,}'
,
number
,
grouping
=
True
)
return
formatted_number
# Placeholder value for demonstration
integer_value
=
12342
# Set locale to get comma separators
locale
.
setlocale
(
locale
.
LC_NUMERIC
,
'en_US.UTF-8'
)
# Output the integer with comma separators
formatted_integer
=
format_with_commas
(
integer_value
)
print(
"The formatted integer is:"
,
integer_value
)
**You must use placeholders**
**Include comments with submissions**
Related Documents
Related Questions
Calculate the missing information for the purchase.
Item
Book
$
Selling
Price
(in $)
Need Help?
Read It
Sales
Tax
Rate
8
Sales
Tax
(in $)
Excise
Tax Rate
0
Excise
Tax
0
Total
Purchase Price
$20.52
arrow_forward
o determine the sales tax (in $) and calculate the total
purchase price (in $) for the item. (Round your answers to the nearest cent.)
Use
Selling
Sales
Total
Item
Price
Таx
Purchase Price
Candy bar
$0.69
$4
2$
arrow_forward
1. School supplies.
Selling price $4.60.
Sales tax rate 3.0%.
What is the sales tax?
arrow_forward
13. Of the items and services offered by the fictional landscaping firm in Chapter 6, which would generally not be
subject to a sales tax?
a. design services
b. fountains
c. pumps
d. outdoor chairs
14. When a transaction recorded in the Sales Receipt window includes sales tax, a default
a. Sales Tax Payable; credited
b. Sales Tax Receivable; credited
account is
C.
Sales Tax Payable; debited
d. Sales Tax Receivable; debited
15.In QuickBooks Online, the Sales Tax Center window is used to record the
a.
remittance of sales tax charged to customers to the proper tax agency.
b. amount of sales tax owed by customers purchasing on account.
C.
amount of sales tax collected from customers during the current period.
d. amount of sales tax collected from customers paying with cash.
arrow_forward
Calculate the missing information for the purchase.
Item
SellingPrice
SalesTaxRate
SalesTax(in $)
ExciseTax Rate
ExciseTax
TotalPurchase Price(in $)
Sofa
$850.00
5
$
0
0
$
arrow_forward
1. How should the $25 Referral Credit be recorded in Runway’s incomestatement?2. When would Runway record the $25 Referral Credit? What are the journalentries Runway would record when the $25 Referral Credit is earned bythe Existing Customer? What are the journal entries Runway would recordwhen the $25 Referral Credit is redeemed against a $100 purchase madeby the Existing Customer?3. Runway is planning to adopt IFRSs in the near future. What is the relevantaccounting guidance it would follow under IFRSs?
arrow_forward
1.Calculate the missing information for the purchase. (Round your answers to the nearest cent.)
Item
SellingPrice
SalesTaxRate
SalesTax(in $)
ExciseTax Rate
ExciseTax(in $)
TotalPurchase Price(in $)
Tire
$106.99
6
$
5
$
$
arrow_forward
33.
DETAILS
BRECMBC9 18.1.010.
Calculate the missing information for the purchase. (Round your answers to the nearest cent.)
Sales
Sales
Tax
Excise
Selling
Price
Total
Purchase Price
(in $)
Item
Тax
Excise
Тax
Tax Rate
Rate
(in $)
(in $)
Tire
$112.99
6.
%24
%24
24
Need Help?
Read It
arrow_forward
A retail store credited the Sales Revenue account for the sales price and the amount of sales tax on sales. If the sales tax rate is 5% and the balance in the Sales Revenue account amounted to $273000, what is the amount of the sales taxes owed to the taxing agency?
$260000
$13000
$273000
$13650
arrow_forward
Explain thoroughly why it is the answer.
arrow_forward
not use ai please
arrow_forward
Calculate the income before income taxes and net income/less. Please show how you got your answer.
arrow_forward
33.
DETAILS
BRECMBC9 18.1.010.
Calculate the missing information for the purchase. (Round your answers to the nearest cent.)
Sales
Sales
Excise
Total
Selling
Price
Excise
Item
Тax
Таx
Tax
Purchase Price
Tax Rate
Rate
(in $)
(in $)
(in $)
Tire
$112.99
6.
arrow_forward
Q4. A sale of merchandise on account for $5,000, terms n/30, is subject to an 8% sales tax.
(a) Should the sales tax be recorded at the time of sale or when payment is received?
Answer: ______________________________________________________________________
(b) What is the amount of the sale?
Answer: ______________________________________________________________________
(c) What is the amount of the increase to Accounts Receivables?
Answer: ______________________________________________________________________
(d) What is the title of the account in which the $400 ($5,000 x 8%) is recorded?
Answer: ______________________________________________________________________
arrow_forward
assume that you are planning to purchase a new laptop for school, work, and home use. go to the website of two computer manufacturers and make a selection. complete the following items and questions. compare the following items for your selections in their financial statements. revenues for products, revenues for services, cost of goods sold, accounts receivable, inventories, accounts payable, and research ad development. what are some factors that can impact the gross profit of a merchandise company? one item that can help investors understand the relationship between net sales and net profits is the gross profit rates. find the financial information needed to calculate the gross profit rate for your two selected companies.
arrow_forward
How is income defined by the IRC? For example, suppose you decided to hold a garage sale one fine summer weekend. The proceeds of such came out to $40. Do you report this? Why or why not?
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

Essentials of Business Analytics (MindTap Course ...
Statistics
ISBN:9781305627734
Author:Jeffrey D. Camm, James J. Cochran, Michael J. Fry, Jeffrey W. Ohlmann, David R. Anderson
Publisher:Cengage Learning
Century 21 Accounting Multicolumn Journal
Accounting
ISBN:9781337679503
Author:Gilbertson
Publisher:Cengage
Related Questions
- Calculate the missing information for the purchase. Item Book $ Selling Price (in $) Need Help? Read It Sales Tax Rate 8 Sales Tax (in $) Excise Tax Rate 0 Excise Tax 0 Total Purchase Price $20.52arrow_forwardo determine the sales tax (in $) and calculate the total purchase price (in $) for the item. (Round your answers to the nearest cent.) Use Selling Sales Total Item Price Таx Purchase Price Candy bar $0.69 $4 2$arrow_forward1. School supplies. Selling price $4.60. Sales tax rate 3.0%. What is the sales tax?arrow_forward
- 13. Of the items and services offered by the fictional landscaping firm in Chapter 6, which would generally not be subject to a sales tax? a. design services b. fountains c. pumps d. outdoor chairs 14. When a transaction recorded in the Sales Receipt window includes sales tax, a default a. Sales Tax Payable; credited b. Sales Tax Receivable; credited account is C. Sales Tax Payable; debited d. Sales Tax Receivable; debited 15.In QuickBooks Online, the Sales Tax Center window is used to record the a. remittance of sales tax charged to customers to the proper tax agency. b. amount of sales tax owed by customers purchasing on account. C. amount of sales tax collected from customers during the current period. d. amount of sales tax collected from customers paying with cash.arrow_forwardCalculate the missing information for the purchase. Item SellingPrice SalesTaxRate SalesTax(in $) ExciseTax Rate ExciseTax TotalPurchase Price(in $) Sofa $850.00 5 $ 0 0 $arrow_forward1. How should the $25 Referral Credit be recorded in Runway’s incomestatement?2. When would Runway record the $25 Referral Credit? What are the journalentries Runway would record when the $25 Referral Credit is earned bythe Existing Customer? What are the journal entries Runway would recordwhen the $25 Referral Credit is redeemed against a $100 purchase madeby the Existing Customer?3. Runway is planning to adopt IFRSs in the near future. What is the relevantaccounting guidance it would follow under IFRSs?arrow_forward
- 1.Calculate the missing information for the purchase. (Round your answers to the nearest cent.) Item SellingPrice SalesTaxRate SalesTax(in $) ExciseTax Rate ExciseTax(in $) TotalPurchase Price(in $) Tire $106.99 6 $ 5 $ $arrow_forward33. DETAILS BRECMBC9 18.1.010. Calculate the missing information for the purchase. (Round your answers to the nearest cent.) Sales Sales Tax Excise Selling Price Total Purchase Price (in $) Item Тax Excise Тax Tax Rate Rate (in $) (in $) Tire $112.99 6. %24 %24 24 Need Help? Read Itarrow_forwardA retail store credited the Sales Revenue account for the sales price and the amount of sales tax on sales. If the sales tax rate is 5% and the balance in the Sales Revenue account amounted to $273000, what is the amount of the sales taxes owed to the taxing agency? $260000 $13000 $273000 $13650arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Essentials of Business Analytics (MindTap Course ...StatisticsISBN:9781305627734Author:Jeffrey D. Camm, James J. Cochran, Michael J. Fry, Jeffrey W. Ohlmann, David R. AndersonPublisher:Cengage LearningCentury 21 Accounting Multicolumn JournalAccountingISBN:9781337679503Author:GilbertsonPublisher:Cengage

Essentials of Business Analytics (MindTap Course ...
Statistics
ISBN:9781305627734
Author:Jeffrey D. Camm, James J. Cochran, Michael J. Fry, Jeffrey W. Ohlmann, David R. Anderson
Publisher:Cengage Learning
Century 21 Accounting Multicolumn Journal
Accounting
ISBN:9781337679503
Author:Gilbertson
Publisher:Cengage