I keep getting cannot convert void to bool errors from the Switch statments.
What am I doing wrong?
using System;
namespace ArchitectArithmetic
{
class Program
{
public static void Main(string args)
{
Console.WriteLine(“Hello, there! What monument would you like to work with? Please choose from one of the following: Teotihuacan, TajMahal, Mecca”);
string monument = Console.ReadLine();
switch(monument)
{
case "Teotihuacan":
Console.WriteLine(CalculateTotalTeoCost());
break;
case "TajMahal":
Console.WriteLine(CalculateTotalTajCost());
break;
case "Mecca":
Console.WriteLine(CalculateTotalMeccaCost());
break;
default:
Console.WriteLine("It is important that you improve your reading skills. Please choose from one of the following: Teotihuacan, TajMahal, Mecca");
}
}
public static double RectArea(double length, double width)
{
return length * width;
}
public static double CircleArea(double radius)
{
return Math.PI * Math.Pow(radius, 2);
}
public static double TriangleArea(double bottom, double height)
{
return 0.5 * bottom * height;
}
public static void CalculateTotalTeoCost()
{
double teoRect = RectArea(1500, 2500);
double teoCircle = CircleArea(375) * 0.5;
double teoTri = TriangleArea(500, 750);
double totalCost = Math.Round((teoRect + teoCircle + teoTri) * 180, 2);
Console.WriteLine($"Total construction of Teotihuacan is {totalCost} pesos.");
}
public static void CalculateTotalTajCost()
{
double tajRect = RectArea(90.5, 90.5);
double tajTri = TriangleArea(24, 24);
double tajTotal = tajRect - (4 * tajTri);
double totalCost = Math.Round(tajRect * 180, 2);
Console.WriteLine($"Total construction of Taj Mahal in Agra, India is {totalCost}.");
}
public static void CalculateTotalMeccaCost()
{
double meccaBigRect = RectArea(284, 264);
double meccaSmallRect = RectArea(180, 106);
double meccaTri = TriangleArea(84, 264);
double totalCost = Math.Round((meccaBigRect + meccaSmallRect - meccaTri) * 180, 2);
Console.WriteLine($"Total construction of Great Mosque of Mecca in Mecca, Saudi Arabia is {totalCost}.");
}
}
}