Question: This question needs to be written in FLOWGORITHM a type of flowchart. I bought a self teaching subscription to prepare for school next year and
This question needs to be written in FLOWGORITHM a type of flowchart. I bought a self teaching subscription to prepare for school next year and this is the way that the school does it. Sadly the book I got has nothing for examples.
Write a toCurrency function. This should take one real argument and return a string.This function should turn any real number into a string in currency form so that it starts with a $ and has only 2 decimal places using the built in function ToFixed(r,i) inside of your function.
An input of 3.141592 should return $3.14
An input of 10.2 should return $10.20
An input of 1000.6666 should return $1000.67
Remember you can use the & operator to concatenate strings together
Write a findDiscount function. This should take one int argument and return a real.This function should take in the number of items being ordered and return discount percentage appropriate for that quantity according to this table:
| Item quantity | Discount Percentage |
|---|---|
| 0 to 100 | 0% |
| 101 to 200 | 4% |
| 201 to 300 | 7% |
| 301+ | 11% |
An input of 103 should return 0.04
An input of 3 should return 0
An input of 301 should return 0.11
With these functions defined now expand the program for a company who gives discounts on items bought in bulk.
Ask the user how many different items they are buying.
For each item have the user input a quantity and price.
Use your findDiscount to find the discount for each item's quantity and calculate the discounted price.
Display the discounted price using your toCurrency function.
Sum the discounted totals for all items and display this grand total at the end using toCurrency
In addition to summing the discounted totals, also sum the un-discounted totals.
At the end display both of these values with toCurrency then calculate and display the overall percentage saved.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
