Application in C# that can be very useful (my first ever)
Posted: Thu Dec 31, 2009 11:16 am
Ok so here is little discription of this application.
It is my first one ever created.
Function: It is able to calculate four surface areas of four diffrent object (cube, cylinder, sphere, rectangular)
Time needed: 45 minutes
Future upgrade: I plan to put volumen too. :P
For some it can be bad code, but this is first time I ever wrote anything so if you have some suggestion how to improve it pleas post comments, I would like to learn.
I also didnt have any time to check it of fix anything if it is wrong. Sorry
It is my first one ever created.
Function: It is able to calculate four surface areas of four diffrent object (cube, cylinder, sphere, rectangular)
Time needed: 45 minutes
Future upgrade: I plan to put volumen too. :P
For some it can be bad code, but this is first time I ever wrote anything so if you have some suggestion how to improve it pleas post comments, I would like to learn.
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace First_useful_application_done_by_EdE
{
class Program
{
static void Main(string[] args)
{
int a, r, h, b, c;
string pageA;
string pageB;
string pageC;
string radius;
string hight;
string objectt;
Console.WriteLine(@"Please enter for which object do you want to calculate surface area
(Cube, Rectangular, Sphere or Cylinder)");
objectt = Console.ReadLine();
switch (objectt)
{
case "Cube":
Console.WriteLine("Give me page A");
pageA = Console.ReadLine();
Console.WriteLine("The surface area of your cube is: ");
a = int.Parse(pageA);
Console.WriteLine(6 * ( a * a ) );
Console.ReadLine();
break;
case "Sphere":
Console.WriteLine("Give me radius r:");
radius = Console.ReadLine();
r = int.Parse(radius);
Console.WriteLine(4 * 3.14 * (r * r));
Console.ReadLine();
break;
case "Cylinder":
Console.WriteLine("Give me radius r");
radius = Console.ReadLine();
r = int.Parse(radius);
Console.WriteLine("Give me hight h");
hight = Console.ReadLine();
h = int.Parse(hight);
Console.WriteLine((2 * 3.14 * (r * r)) + (2 * 3.14 * (r * h)));
Console.ReadLine();
break;
case "Rectangular":
Console.WriteLine("Give me page A");
pageA = Console.ReadLine();
a = int.Parse(pageA);
Console.WriteLine("Give me page B");
pageB = Console.ReadLine();
b = int.Parse(pageB);
Console.WriteLine("Give me page C");
pageC = Console.ReadLine();
c = int.Parse(pageC);
break;
}
}
}
}