ahm mga dude pa help ko sa sa c# language kuan pa ko beginner pa ko .. naa gi hatag na prob sa ako amo a prof. Menu of Volume Cylinder.cube,sphere. mo ask siya ug answer. tabangi ko ani mga master
![]()
ahm mga dude pa help ko sa sa c# language kuan pa ko beginner pa ko .. naa gi hatag na prob sa ako amo a prof. Menu of Volume Cylinder.cube,sphere. mo ask siya ug answer. tabangi ko ani mga master
![]()
first of, kabalo ka sa formula sa Volume for Cylinder, Cube and Sphere? Kung wala pa, kana ang unaha ug research. Once done, post what you have started here.
I'll give you a hint para sayon, create a program that would determine the volume of each(Cylinder, Cube, Sphere). Then combine them into one program later.
PS:
dili nako mohatag ug codes ngari kay daghan kaayo masuko diri. No to assignment posts daw.
post lang dri brad hehe, c# console app? gamite lag switch statement pra sa imu menu. dali rana bro =)
post dayon kay answeran.
Unsa namay update ani? hihihi
TS wala pakay update dinha, hot kaayo si @ProudMonkey or @niehrx, next time if makakita namo og answer pahibalo sad mo, ..hehehehe..
Code:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { const double PI = 3.142; double radius = 0; double volume = 0; Console.WriteLine("Choose from the menu:\n" + "[a] Cyclinder\n" + "[b] Cube\n" + "[c] Sphere"); string choice = Console.ReadLine(); switch (choice) { case "a": case "A": Console.Write("Enter Radius: "); radius = double.Parse(Console.ReadLine()); Console.Write("Enter Heigt: "); double height = double.Parse(Console.ReadLine()); volume = PI * (radius * radius) * height; break; case "b": case "B": Console.Write("Enter Length: "); double length = double.Parse(Console.ReadLine()); volume = Math.Pow(length, 3); break; case "c": case "C": Console.Write("Enter Radius: "); radius = double.Parse(Console.ReadLine()); volume = (4.0 / 3.0) * PI * Math.Pow(radius, 3); break; default: Console.WriteLine("Invalid Input! Tarunga!"); break; } Console.Write("Volume is: " + volume); Console.ReadKey(); } } }
@superstar: Ako post para hang TS unto ta, kay wala man mag followup...heheheh....
On a side note, when the user enters letters for sure it will throw an exception, I think TryParse(...) can be use to avoid the exception. But other than, I guess thats it.
Similar Threads |
|