Hello once again fellow programmers I need help with a C# program. The program is supposed to include fields named radius, are and diameter. I got most of it up but it is not working saying there does not contain a static 'Main' method for suitable entry point.

using System;
using System.Collections.Generic;
using System.Text;
public class Circle
{
    private double radius;
    private double area;
    private double diameter;


    public Circle(double givenRadius)
    {
        radius = givenRadius;
    }

    public Circle()
    {
        radius = 10.0;
    }

    public double getRadius()
    {
        return radius;
    }

    public void setRadius(double givenRadius)
    {
        radius = givenRadius;
    }

    public double computeDiameter()
    {
        diameter = 2 * radius;
        return diameter;
    }

    public double computeArea()
    {
        area = Math.PI * radius * radius;
        return area;
    }
}

public class TestCircle
{
    public static void main(String[] args)
    {
        Circle defaultCircle = new Circle();
        Console.WriteLine("Default Circle:");
        Console.WriteLine("Diameter: " + defaultCircle.computeDiameter() + "Area: " + defaultCircle.computeArea());
        Console.ReadLine();
    }
}

Recommended Answers

All 2 Replies

What is your project type? Is it class library or windows application? Sounds like it is a windows application project.

If thats all your code then what its told you is right, it looks like you tried to make a console app but maybe by mistake overwrote the Main procedure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.