I am writing a program that uses methods to take a user input for income and output what their income tax owed would be.
I have one error on line 46 which is ``private double GetTax(double taxable)` The GetTax is a CS0161 - not all code paths return a value.
Am I missing a reference to GetTax? Your input is much appreciated!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Lab_4_Part_2_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnCalculate_Click(object sender, EventArgs e)
{
//Set input and output to floating decimal
double taxable = Convert.ToInt32(txtTaxable.Text);
GetTax(taxable);
}
private void EnterNum(double taxable)
{
throw new NotImplementedException();
}
private double GetTax(double taxable)
{
if (taxable <= 9225) return (taxable * 1.1);
if (taxable > 9225 | taxable < 37450) return (922.50 + (taxable * 1.15));
if (taxable > 37450 | taxable < 90750) return (5156.25 + (taxable * 1.25));
if (taxable > 90750 | taxable < 189300) return (18481.25 + (taxable * 1.28));
if (taxable > 189300 | taxable < 411500) return (46075.25 + (taxable * 1.33));
if (taxable > 411500 | taxable < 413200) return (119401.25 + taxable * 1.35);
if (taxable > 413200) return (119996.25 + (taxable * 1.396));
}
public string DisplayTaxable(double taxable)
{
return txtOwed.Text;
}
}
}