0

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();
    }
}
3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by LizR
0

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

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.