Hey all, i am a newbie at C# and need help with this program. This is what i have so far.The first part of the program work, but the second method InchesToFeetdoes not work. Please help. Due on Monday.
Create a class named InchesToFeet. Its Main ( ) method holds an integer variable
named inches to which you will assign a value. Create a method to which you pass inches. The method displays inches in feet and inches. For example, 67 inches is 5 feet 7 inches. Save the program as InchesToFeet.cs.
b. Add a second method to the InchesToFeet class. This method displays a passed
argument as yards, feet, and inches. For example, 67 inches is 1 yard, 2 feet, and 7 inches. Add a statement to the Main ( ) method so that after it calls the method to convert inches to feet and inches, it passes the same variable to the new method to convert the same value to yards, feet, and inches. Save the program as InchesToYards.cs
using System;
class InchesToFeet
{
static void Main()
{
//Declare variable
int inches = 43;
//output to the screen
Console.WriteLine("67 inches is ");
totalFeet(inches);
Console.ReadLine();
}
//Method to pass inches
public static void totalFeet(int inches)
{
//Calculation conversion for feet and inches
int feet;
double tInches;
feet = inches / 12;
tInches = .58333 * 12;
tInches = Convert.ToInt32(tInches);
Console.WriteLine("{0} feet and {1} inches", feet, tInches);
}
public static void totalYards(int inches)
{
double feet;
double yards;
double tInches;
yards = .02777;
yards = Convert.ToInt32(yards);
yards = (.58333 - .02777 * 36) % 12;
feet = .19444 * 12;
feet= Convert.ToInt32(feet);
tInches = .33328 * 12;
tInches = Convert.ToInt32(tInches);
Console.WriteLine("{0} yard {1} feet and {2} inches", yards, feet, tInches);
}
}