Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: Three variables, price, tax and discount, supposedly hold strings of digits, suitable for converting to floats. Write code that converts them and displays the

Assignment: Three variables, price, tax and discount, supposedly hold strings of digits, suitable for converting to floats. Write code that converts them and displays the total cost (price *(1+ tax)- discount), rounded to the second decimal digit. However, if any variable fails to convert, display a string "Failed to convert value(s): " followed by the names of the variable(s) that failed, separated by space. The variables should be sorted as price, tax and discount.
If in order the variables were "Hi","0.09","1:99", the output would be Failed to convert value(s): price discount.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

Communication is a process. What does this mean?

Answered: 1 week ago

Question

Types of Interpersonal Relationships?

Answered: 1 week ago

Question

Self-Disclosure and Interpersonal Relationships?

Answered: 1 week ago