The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I need some help with a C# Console Program. Please do not change my existing code, with exception of any additions or changes required to help me with my specific problem. I have two classes. I am having issues calling one class from another. You will see some code in 'main' class commented out that I have been trying (Lines 50 - 64). I need to understand how to do the following:
1) Call 'Main' from the 'AreaConverter' class and use the value of "area" in the AreaConverter class to complete the additional calculations.
2) Call 'AreaConverter' class from the 'Main' class to print out the results of the additional calculations performed in 'AreaConverter' class.
Thanks
Â
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Exceptions{class AreaConverter{double area = 0.0;double sqftin = 0.00694444;double sqcentin = 6.4516;double sqmeterin = 0.00064516;double sqft = 0.0;double sqcent = 0.0;double sqmeter = 0.0;// Method to Convert the Area into Square Feet, Square Centimeters,Square Meterspublic static void totConvert(double area, double sqftin, doublesqcentin, double sqmeterin, out double sqft, out double sqcent, out doublesqmeter){// Convert Area Square Inches to Square Feetsqft = area * sqftin;// Convert Area Square Inches to Square Centimeterssqcent = area * sqcentin;// Convert Area Square Inches to Square Meterssqmeter = area * sqmeterin;}}}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Exceptions;namespace Exceptions{class Exceptions{static void Main(){// Variables Initializedvar length = 0.0;// Length Inputvar width = 0.0;// Width Inputvar area = 0.0;// Area Outputvar perimeter = 0.0;// Perimeter Outputdouble sqft = 0.0;double sqcent = 0.0;double sqmeter = 0.0;// Welcome MessageConsole.WriteLine("\n\t\tWELCOME TO AREA & PERIMETER CONVERSIONCALCULATOR!");Console.WriteLine("\n\t****************************************************************");// Prompt for Length of RectangleConsole.Write("\n\tPlease Enter the Length of the Rectangle: ");// Call Method to capture the Length of Rectanglelength = recLength();// Prompt for Width of RectangleConsole.Write("\n\tPlease Enter the Width of the Rectangle: ");// Call Method to capture the Width of Rectanglewidth = recWidth();// Call Method to Calculate the Area anad Perimeter of RectangletotAreaPerim(length, width, out area, out perimeter);// Display the Required ResultsConsole.WriteLine("\n\tAREA & PERIMETER VALUES");Console.WriteLine("\n\t****************************************************************");Console.WriteLine("\n\tThe Area of the Rectangle is: \t\t\t{0}sq.in.", area);Console.WriteLine("\n\tThe Perimeter of the Rectangle is: \t\t{0}sq.in.", perimeter);Console.WriteLine("\n\t****************************************************************");//==================WORKING CODE==========================//Call the Area Converter class//Exceptions.AreaConverter Except = new AreaConverter();//Except.totConvert(sqft, sqcent, sqmeter).ToString();Console.WriteLine("\n\tAREA CONVERSION (SQUARE FEET, SQUARE
-----------