Click here to Skip to main content
15,915,163 members
Home / Discussions / C#
   

C#

 
GeneralRe: Attach autorun.inf to setup Pin
lukeer12-Oct-11 23:52
lukeer12-Oct-11 23:52 
QuestionHow to Zip Folder in C# Pin
Sunil G 312-Oct-11 18:40
Sunil G 312-Oct-11 18:40 
AnswerRe: How to Zip Folder in C# Pin
Dennis E White12-Oct-11 19:50
professionalDennis E White12-Oct-11 19:50 
AnswerRe: How to Zip Folder in C# Pin
Abhinav S12-Oct-11 20:24
Abhinav S12-Oct-11 20:24 
AnswerRe: How to Zip Folder in C# PinPopular
BobJanova12-Oct-11 23:22
BobJanova12-Oct-11 23:22 
GeneralRe: How to Zip Folder in C# Pin
harold aptroot13-Oct-11 5:46
harold aptroot13-Oct-11 5:46 
QuestionNeed lots of help! Pin
Bobbybrown1212-Oct-11 9:42
Bobbybrown1212-Oct-11 9:42 
AnswerRe: Need lots of help! Pin
DaveyM6912-Oct-11 9:52
professionalDaveyM6912-Oct-11 9:52 
It's basic maths, and can be done in a procedural manner, or better still by creating a class that contains the main functionality.

Consider this Pizza class that contains all the pizza related stuff, a Pizza instance can now be created and you just need to handle the UI stuff and the class will contain all the other info you need:

C#
using System;

public class Pizza
{
    public const int MaxDiameter = 36;
    public const int MinDiameter = 12;

    private int diameter;

    public Pizza(int diameter)
    {
        if (diameter < MinDiameter || diameter > MaxDiameter)
            throw new ArgumentOutOfRangeException(
                "diameter",
                string.Format(
                    "diameter must be between {0} and {1}",
                    MinDiameter, MaxDiameter));
        this.diameter = diameter;

    }

    public double Area
    {
        get { return Math.PI * (Math.Pow((diameter / 2d), 2)); }
    }
    public int Diameter
    {
        get { return diameter; }
    }
    public double SliceArea
    {
        get { return Area / Slices; }
    }
    public int Slices
    {
        get
        {
            int slices;
            if (diameter < 16)
                slices = 8;
            else if (diameter < 24)
                slices = 12;
            else if (diameter < 30)
                slices = 16;
            else
                slices = 24;
            return slices;
        }
    }
}

Dave

Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.
Astonish us. Be exceptional. (Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)



GeneralRe: Need lots of help! Pin
Bobbybrown1212-Oct-11 10:02
Bobbybrown1212-Oct-11 10:02 
GeneralMessage Removed Pin
12-Oct-11 10:18
professionalN_tro_P12-Oct-11 10:18 
GeneralRe: Need lots of help! Pin
Bobbybrown1212-Oct-11 10:23
Bobbybrown1212-Oct-11 10:23 
GeneralRe: Need lots of help! Pin
DaveyM6912-Oct-11 10:24
professionalDaveyM6912-Oct-11 10:24 
GeneralMessage Removed Pin
12-Oct-11 10:43
professionalN_tro_P12-Oct-11 10:43 
GeneralRe: Need lots of help! Pin
DaveyM6912-Oct-11 10:45
professionalDaveyM6912-Oct-11 10:45 
GeneralRe: Need lots of help! Pin
Alisaunder13-Oct-11 4:31
Alisaunder13-Oct-11 4:31 
GeneralRe: Need lots of help! Pin
BobJanova13-Oct-11 4:53
BobJanova13-Oct-11 4:53 
GeneralRe: Need lots of help! Pin
Alisaunder14-Oct-11 0:59
Alisaunder14-Oct-11 0:59 
GeneralRe: Need lots of help! Pin
BobJanova14-Oct-11 2:36
BobJanova14-Oct-11 2:36 
GeneralRe: Need lots of help! Pin
BillWoodruff12-Oct-11 15:05
professionalBillWoodruff12-Oct-11 15:05 
GeneralRe: Need lots of help! Pin
BobJanova12-Oct-11 23:11
BobJanova12-Oct-11 23:11 
GeneralRe: Need lots of help! Pin
Richard MacCutchan12-Oct-11 23:23
mveRichard MacCutchan12-Oct-11 23:23 
GeneralRe: Need lots of help! Pin
DaveyM6912-Oct-11 23:57
professionalDaveyM6912-Oct-11 23:57 
GeneralRe: Need lots of help! Pin
BillWoodruff14-Oct-11 18:04
professionalBillWoodruff14-Oct-11 18:04 
GeneralRegarding the style of OO discussion Pin
BobJanova13-Oct-11 3:23
BobJanova13-Oct-11 3:23 
GeneralRe: Regarding the style of OO discussion Pin
BillWoodruff14-Oct-11 18:24
professionalBillWoodruff14-Oct-11 18:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.