Mark Park

Mark Park

  • NA
  • 2
  • 2.2k

Use of unassigned local variable taxOwed

Nov 3 2014 6:29 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Taxes2MP
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter your income");
double income = Double.Parse(Console.ReadLine());
}
static string CalculateTax(FilingStatus fs, double income)
{
string taxOwed;
if (fs.Equals(FilingStatus.Single))
{
if (income <= TaxCalculations.Single10)
{
taxOwed = ".1 * income";
}
else if (income <= TaxCalculations.Single15)
{
taxOwed = ".15 * income";
}
else if (income <= TaxCalculations.Single25)
{
taxOwed = ".25 * income";
}
else if (income <= TaxCalculations.Single28)
{
taxOwed = ".28 * income";
}
else if (income <= TaxCalculations.Single33)
{
taxOwed = ".33 * income";
}
else
{
taxOwed = ".35 * income";
}
}
if (fs.Equals(FilingStatus.MarriedJoint))
{
if (income <= TaxCalculations.MarriedJoint10)
{
taxOwed = ".1 * income";
}
else if (income <= TaxCalculations.MarriedJoint15)
{
taxOwed = ".15 * income";
}
else if (income <= TaxCalculations.MarriedJoint25)
{
taxOwed = ".25 * income";
}
else if (income <= TaxCalculations.MarriedJoint28)
{
taxOwed = ".28 * income";
}
else if (income <= TaxCalculations.MarriedJoint33)
{
taxOwed = ".33 * income";
}
else
{
taxOwed = ".35 * income";
}
}
if (fs.Equals(FilingStatus.MarriedSeparate))
{
if (income <= TaxCalculations.MarriedSeparate10)
{
taxOwed = ".1 * income";
}
else if (income <= TaxCalculations.MarriedSeparate15)
{
taxOwed = ".15 * income";
}
else if (income <= TaxCalculations.MarriedSeparate25)
{
taxOwed = ".25 * income";
}
else if (income <= TaxCalculations.MarriedSeparate28)
{
taxOwed = ".28 * income";
}
else if (income <= TaxCalculations.MarriedSeparate33)
{
taxOwed = ".33 * income";
}
else
{
taxOwed = ".35 * income";
}
}
if (fs.Equals(FilingStatus.HeadOfHouse))
{
if (income <= TaxCalculations.HeadOfHouse10)
{
taxOwed = ".1 * income";
}
else if (income <= TaxCalculations.HeadOfHouse15)
{
taxOwed = ".15 * income";
}
else if (income <= TaxCalculations.HeadOfHouse25)
{
taxOwed = ".25 * income";
}
else if (income <= TaxCalculations.HeadOfHouse28)
{
taxOwed = ".28 * income";
}
else if (income <= TaxCalculations.HeadOfHouse33)
{
taxOwed = ".33 * income";
}
else
{
taxOwed = ".35 * income";
}
}
return taxOwed;
}
}
}
 
I'm trying to calculate taxes depending on how much the person makes depending on their filing status. 

Answers (1)