Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# program... In Main create the following variables, one for the amount of a bill owed, a constant for the tax rate, and one for

C# program... In Main create the following variables, one for the amount of a bill owed, a constant for the tax rate, and one for the percentage of tip, one for the actual amount of the tax, one for the actual amount of the tip, and one to hold the total amount of the bill.

Create one function using out parameters to ask the user for the amount of their bill and the tip percentage they wish to pay. Please make sure to use good prompts for this. Example: Please enter the percentage of tip you wish to leave as a decimal number (20% = 0.20):

Create a second function that receives the amount of bill that is owed, the tax rate, and the tip percentage, and as out parameters the tip amount owed, tax amount owed and total bill amount owed. Make the tax rate and the tip percentage optional parameters by assigning 0.0825 to tax rate and 0.20 to tip percentage. If the user does not send in a value for tax rate or tip percentage, then these values will be used.

The function should then calculate their amount of tip and tax and the total amount of the bill. Be sure you sent the calculated tip, tax and total amounts as out parameters so these values will be sent back to Main.

From Main print out their original bill amount plus their tax, their tip, and their total.

Don't forget to make the output look like currency. Also, be sure to test the input to make sure they are inputting information that can be converted to a double.

The point of this program is that you declare all variables in main, but the only one set in main is the tax rate. The other variables will receive their values from functions using out parameters and optional parameters. These functions will not use return statements to set the values.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions