a) Design an algorithm using pseudo code for a program that uses functions to calculate the total bill for water consumption every month. The program uses two functions. One function to read user input and another function to calculate the total bill. The information required: • Account number • Previous meter reading • Current meter reading • Standing charge which is around 4$ • Cost per unit of consumption • Tax which is 3% of the consumption cost. • Consumption is the difference between current reading and previous reading • Consumption cost is the sum of standing charge and the product of consumption and cost per unit of consumption. • Total cost of the bill is consumption cost plus the tax. b). Use the string “GDECAEHJXZQR” to perform the following tasks: i. Construct a binary search tree(BST) for this string ii. Traverse the tree using preorder traversal. iii. Use merge sort to arrange the letters in this string in ascending order
a) Design an
• Account number
• Previous meter reading
• Current meter reading
• Standing charge which is around 4$
• Cost per unit of consumption
• Tax which is 3% of the consumption cost.
• Consumption is the difference between current reading and previous reading
• Consumption cost is the sum of standing charge and the product of consumption and cost per unit of consumption.
• Total cost of the bill is consumption cost plus the tax.
b). Use the string “GDECAEHJXZQR” to perform the following tasks:
i. Construct a binary search tree(BST) for this string
ii. Traverse the tree using preorder traversal.
iii. Use merge sort to arrange the letters in this string in ascending order
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)