Copyright (c) Level 2014 Software 1 class//All rithts reseved.//A36 Huanghade//Completion Date: December 9, 2014////problem Description: Create a program to find the cylinder surface area and volume//output: Surface area and volume//u Sing system;using system.collections.generic;using system.linq;using system.text;using System.Threading.Tasks; Namespace consoleapplication4{class Program {static void Main (string[] args) {Cylinder c Oumn1 = new Cylinder ();//Create Object coumn1.height = 3.5;//Reference class member Coumn1. R = 3;//refers to the class member Console.WriteLine ("Volume: {0}", Coumn1. Bulk ()); Console.WriteLine ("Surface area: {0}", Coumn1. superficial ()); Console.readkey (); }} class Cylinder {Public double r;//defines the radius of the circle of the function R as a cylinder public double height;//defines the high public double superficial ()///Of the height cylinder ()///define function superficial {do uble lateral,s;//definition variable lateral: Side area, S: Round bottom area double x=3.1415;//define variable x: pi lateral = (R + Hei ght) * 2; S = x * Math.pow (R, 2); return lateral + S * 2; } public double Bulk () {Double x = 3.1415;//definition variable s: Round bottom area, x: Pi return x * MATH.POW (R, 2) *height; } }}
Surface area and volume of cylinders