Company Earnings Simulator
Company Earnings Simulator
You wish to simulate the annual earnings of a particular medium sized company. Create a C# WPF (desktop) application that will allow a user to enter a range of years and a range of minimum and maximum sales earnings and then generates and displays random sales figures, estimated taxes, expenses and profit figures.
- Create a program that inputs the Starting Year and Ending Year, the Minimum Quarterly Sales and Maximum Quarterly Sales and then outputs simulated Quarterly Sales figures along with Sales Totals, Estimated Taxes and Expenses. Details on these calculations are given below.
- Layout controls on a WPF window with suitable names as shown below
(you may use either a textbox or a listbox to output your table of results):
- Calculate Button: When clicked, the calculate button should:
- Get the inputs from the user (see validation rules in part (4) below)
- Loop over the required number of years and perform the operations in steps (i) to (vi) below:
- Call the GetSales() function (see part (5) below) to generate random sales figures for each quarter ( Q1 sales, Q2 Sales etc.)
- Add up the 4 quarterly sales figures to get a Sales Total.
- Call the GetTaxes() function (see part (6) below) to determine the estimated Taxes.
- Calculate the Expenses using the formula: Expenses = Sales Total * Expense Rate / 100
- Calculate the Net Profit using the formula: Net Profit = Sales Total – Taxes – Expenses
- Display a row in the output table. Note that the Sales Total, Taxes and Expenses values must always be calculated, but should only be displayed in the output columns if the corresponding checkbox is checked (see part 7 below).
- Input Validation: If the user inputs invalid values (see rules below) display an error message warning the user to correct their input. You may output your error messages using either a messagebox or a label on the window:
- All inputs are required (no blank inputs allowed)
- All inputs must be numbers (no non-numeric text can be entered)
- The End Year must be later than the Start Year AND the End Year must not be more than 25 years after the Start Year (i.e. we will run the simulation for no more than 25 years)
- The Maximum Quarterly Sales must be larger than the Minimum Quarterly Sales. Although the simulation will work best for realistic sales amounts, there are no restrictions on the size of these quarterly sales figures. These values may be INTEGERS – that is, we will run the simulation only for whole number dollar values, even though the outputs will show 2 decimal places.
- The Expense Rate must be a floating point value between 0 to 100 %
- No results should be calculated or displayed if the user does not enter valid inputs.
- GetSales() Function: This function/method should:
- Accept a Minimum and a Maximum INTEGER number (taken from the Minimum Quarterly Sales and Maximum Quarterly Sales user inputs)
- Return a random INTEGER value between these numbers
- Except for a globally defined random number object, this function must operate only on the arguments passed into it and not access any global variables or input controls.
- GetTaxes() Function: This function/method should:
- Accept a Sales Total value (taken from your calculated values in (3.b.ii)
- Calculate and return a floating point number for the Taxes using the following
formula: Tax = Sales Total * Tax Rate / 100
- The Tax Rates are listed in the following table:
Sales Total for the Year Tax Rate (%)
Is 0.00 up to but not including 100 000.00 0.0%
Is 100 000.00 up to but not including 175 000.00 10.0%
Is 175 000.00 up to but not including 250 000.00 15.0%
Is 250 000.00 up to but not including 350 000.00 25.0%
Is 350 000.00 or more 35.0%
- This function must operate only on the arguments passed into it and not access any global variables or input controls.
- Checkboxes and Displayed Columns: The columns displayed in your output depend on the checkbox checked states:
- The Sales Total column should be output only if the Show Sales Total checkbox is checked.
- The Taxes column should be output only if the Show Taxes checkbox is checked.
- The Expenses column should be output only if the Show Expenses checkbox is checked.
- No result should be calculated or displayed if the user does not enter valid inputs.
- Other Requirements and notes:
- You may format your output table with any horizontal alignment that you like, but the output table must be well formatted with good vertically aligned columns. Make your table tidy.
- Although the randomly generated Quarterly Sales figures are integer dollars, all other calculated and displayed values must be floating point numbers.
- Use comments to describe the details of each important block of code, each function definition and formula.
- Although you may be as detailed as you like, your comments must be clear, but do not have to be long. Just a few lines of comments that clearly describe the meaning of each important feature in your code is all that is needed.
- Collaboration and problem solving with other students is allowed, But your work must be your own. Use good variable names and clear comments to demonstrate that you understand your work.
General Marking Scheme
10% Form layout and design
10% Clear and meaningful variable names and input control names
20% Clear and meaningful comments.
Your comments must show that you understand your program code!
50% Correct working code and proper program design and style (indenting etc.)
10% Program produces correct output
100% Total Marks
- Assignment Help
- Homework Help
- Writing Help
- Academic Writing Assistance
- Editing Services
- Plagiarism Checker Online
- Research Writing Help