Click here to Skip to main content
16,004,969 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Need lots of help! Pin
DaveyM6912-Oct-11 10:20
professionalDaveyM6912-Oct-11 10:20 
GeneralMessage Removed Pin
12-Oct-11 10:21
professionalN_tro_P12-Oct-11 10:21 
GeneralRe: Need lots of help! Pin
DaveyM6912-Oct-11 10:28
professionalDaveyM6912-Oct-11 10:28 
AnswerRe: Need lots of help! Pin
BillWoodruff12-Oct-11 15:08
professionalBillWoodruff12-Oct-11 15:08 
AnswerRe: Need lots of help! Pin
BobJanova12-Oct-11 23:20
BobJanova12-Oct-11 23:20 
This is pretty straightforward, and having someone give you the answer is much less valuable than you going back and reading over the control structures part of your course so you can do it. Flow of control (if/else, switch and loops) are fundamental to programming (at least in a conventional language) and you need to understand them – when you do, this exercise is trivial.

Since I need to get some silliness out of the way before production code catches it, here is a tongue-in-cheek version of the logic (which will probably fail your test, heh):

double area = diameter * diameter * 0.25 * Math.Pi;
int slices = diameter < 12 ? 0 :
          diameter < 16 ? 8 : 
          diameter < 24 ? 12 :
          diameter < 30 ? 16 :
          diameter < 36 ? 24 : 0;
if(slices == 0) throw new ArgumentException("Size out of range");
double sliceArea = area / slices;


Or how about

int[][] sliceMap = {{12, -1},{16, 8},{24, 12},{30, 16},{36,24}};
int slices = -1;

foreach(int[] mapping in sliceMap){
 if(diameter < mapping[0]){ slices = mapping[1]; break; }
}
if(slices < 0) throw new ArgumentException("Size out of range");


Remember, don't hand something like this in Wink | ;) . Go and read about if/else since that's clearly what the exercise is checking.
QuestionIssue with creating bitmap image data for Format8bppIndexed and Format4bppIndexed Pin
AMSR12-Oct-11 8:35
AMSR12-Oct-11 8:35 
AnswerRe: Issue with creating bitmap image data for Format8bppIndexed and Format4bppIndexed Pin
BobJanova12-Oct-11 22:46
BobJanova12-Oct-11 22:46 
GeneralRe: Issue with creating bitmap image data for Format8bppIndexed and Format4bppIndexed Pin
AMSR12-Oct-11 23:24
AMSR12-Oct-11 23:24 
GeneralRe: Issue with creating bitmap image data for Format8bppIndexed and Format4bppIndexed Pin
AMSR12-Oct-11 23:27
AMSR12-Oct-11 23:27 
QuestionHow to Programatically find the application pool of an applicatiom Pin
yaju patel12-Oct-11 4:14
yaju patel12-Oct-11 4:14 
AnswerRe: How to Programatically find the application pool of an applicatiom Pin
Ravi Bhavnani13-Oct-11 16:21
professionalRavi Bhavnani13-Oct-11 16:21 
GeneralRe: How to Programatically find the application pool of an applicatiom Pin
yaju patel14-Oct-11 1:43
yaju patel14-Oct-11 1:43 
GeneralRe: How to Programatically find the application pool of an applicatiom Pin
Ravi Bhavnani14-Oct-11 1:47
professionalRavi Bhavnani14-Oct-11 1:47 
QuestionGet Client machine localization Pin
Mugdha_Aditya12-Oct-11 2:55
Mugdha_Aditya12-Oct-11 2:55 
AnswerRe: Get Client machine localization Pin
Eddy Vluggen12-Oct-11 7:22
professionalEddy Vluggen12-Oct-11 7:22 
GeneralRe: Get Client machine localization Pin
Mugdha_Aditya12-Oct-11 19:38
Mugdha_Aditya12-Oct-11 19:38 
AnswerRe: Get Client machine localization Pin
Bernhard Hiller12-Oct-11 19:56
Bernhard Hiller12-Oct-11 19:56 
GeneralRe: Get Client machine localization Pin
Mugdha_Aditya12-Oct-11 20:08
Mugdha_Aditya12-Oct-11 20:08 
Questionblock os Pin
mspmohanraj11-Oct-11 20:02
mspmohanraj11-Oct-11 20:02 
AnswerRe: block os Pin
Richard MacCutchan11-Oct-11 21:50
mveRichard MacCutchan11-Oct-11 21:50 
GeneralRe: block os Pin
harold aptroot11-Oct-11 21:54
harold aptroot11-Oct-11 21:54 
AnswerRe: block os Pin
Dave Kreskowiak12-Oct-11 1:46
mveDave Kreskowiak12-Oct-11 1:46 

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.