![]() It could use a couple more classes to encapsulate most of whats is going on int the Main() method.While they are small classes and it would be fine in this instance, but its best practice for larger projects Grouping the custom exceptions together should be done with a folder. one class per file *Note this is a general rule so it does have its exceptions.The Objects you have are modeled well and encapsulate the functionality pretty well. I am sorry to hear that and wish you a speedy recovery! Life > code hahaĪnyway as for the code, this is definitely heading in the right direction. Console.ReadLine() should wait for input anyway so they may not be needed. Lastly, 'while(true)' is valid but bad form, you will be able to find better ways to control the logic flow (ones that don't have inherent risks of an infinite loop : ) ). Try creating classes that model objects using the properties as the dimensions and the methods to do all the computations. Try to think about the objects involved, namely triangles, circles, and rectangles (being squares are rectangles you can use some inheritance magic here). Secondly, this is a very procedural approach, the classes you have are static helper classes that handle the computations and the main method handles the interaction with the user. if there is more than trivial logic it should be in its own method at the very least (better if its in another class I dont like having other methods on the Main.cs to keep the whole file as minimal as possible). Now I am not sure what the instructions for the calculator are specifically but i have a few pointers just based on what you have.įirst, try to keep you Main() method to a minimum.
0 Comments
Leave a Reply. |