I'm new to c# and I need help converting this-any help would be greatly appreciated.-I was previously in a java class and now I'm in c# class with the same assignment.
Code:
public class Furniture
{
public static void main(String[] args)
{
int tree = 0;
Scanner scan = new Scanner(System.in);
System.out.println("Enter \n 1 for pine \n 2 for oak \n 3 for mahogany");
try
{
tree = scan.nextInt();
}
catch(Exception e)
{
System.out.println("Invalid input. Only numbers are accepted");
}
int cost = 0;
if(tree == 1)
cost = 100;
else if(tree == 2)
cost = 225;
else if(tree == 3)
cost = 310;
else
cost = 0;
String tab = "";
if(tree == 1)
tab = "Pine";
else if(tree == 2)
tab = "Oak";
else if(tree == 3)
tab = "Mahogany";
System.out.println("This " + tab + " table will cost you $" + cost);
}
Comment