, Visual C#



76.1. Part 3. Program.cs.

#region Using directives

using System;

using System.Collections.Generic;

using System.Text;

#endregion

namespace ConsoleApplication1

{

class Program

{

// :

double d, H, s; double pi = Math.PI;

double rho=7850; //: for steel.

double A, V, m, D;

double Area() // :

{

double A1, A2;

A1=Area1(); A2=Area2(); A=A1+A2;

return A;

}

double Volume() // :

{

A=Area(); V=A*s; return V;

}

double mass() // :

{

Console.Write("Part diameter, mm, d =");

d = Convert.ToDouble(Console.ReadLine());

Console.Write("Part heigth, mm, H =");

H = Convert.ToDouble(Console.ReadLine());

Console.Write("Part thickness, mm, s =");

s = Convert.ToDouble(Console.ReadLine());

A=Area();

V=Volume(); //mm*mm*mm

m=V*rho*1.0e-9; // kg

Console.WriteLine("");// .

// :

Console.Write("Part area, mm*mm, A =");

Console.WriteLine(A);

// :

Console.Write("Part volume, mm*mm*mm, V =");

Console.WriteLine(V);

// :

Console.Write("Part mass for steel,kg,m=");

Console.WriteLine(m);

return m;

}

double DBlank() // :

{

A=Area();

D=Math.Sqrt(4*A/pi);

// :

Console.Write("Blank diameter, mm, D =");

Console.WriteLine(D);

Console.WriteLine("");// .

return D;

}

double Area1() // :

{