Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How do I add 4 more methods to this program while displaying instructions like \

ID: 3913037 • Letter: H

Question

How do I add 4 more methods to this program while displaying instructions like "This program will convert feet and inches into meters and centimeters"? using System; using static system.Console; namespace Methods public class Methods { public static void Main() { string userInput; int feetVal, inchVal; int totalInches; double totalCms; int heightMeter, heightCm; Console.Write("Enter height (feet)"); userInput = Console.ReadLine(); /* Convert to integer type */ feetVal = Convert.ToInt32(userInput); Console.Write("Enter height (inches) "); userInput = Console.ReadLine(); inchVal = Convert.ToInt32(userInput); // once feet has 12 inches totalInches = feetVal * 12 + inchVal; // lets convert the inches to centimeters - once inch roughly is equal to 2.54 centimeters totalCms = totalInches * 2.54; heightMeter = (int)totalCms / 100; heightCm = (int)totalCms % 100; Console.WriteLine("Input height in (feet and inches) {0} feet {1} inches", feetVal, inchVal); Console.WriteLine("Input height int (meter and cms) {0} meter {1} cm", heightMeter, heightCm); } }

Explanation / Answer

UPDATED C# PROGRAM

using System;
using static System.Console;


class Methods
{
// implement totalInch() method
public static int totalInch(int a,int b)
{
return(a*12+b); // return inches
}
// implement totalCentimeters() method
public static double totalCentimeters(int a)
{
return a*2.54; // return total centimeters
}
// implement heightMt() method
public static int heightMt(double a)
{
return (int)a/100; // return height
}
// implement heightCmt() method
public static int heightCmt(double a)
{
return (int)a%100; // return centimeters
}
// implement show() method for display content
public static void show(int a,int b,int x,int y)
{
Console.WriteLine(" Convert Feet and Inches into Meters and Centimeters ");
Console.WriteLine("Input height in (feet and inches) {0} feet {1} inches", a, b);
Console.WriteLine("Input height in (meter and cms) {0} meter {1} cm", x, y);
}
  
public static void Main()
{
string userInput;
int feetVal, inchVal;
int totalInches;
double totalCms;
int heightMeter, heightCm;
Console.Write("Enter height (feet)");
userInput = Console.ReadLine(); /* Convert to integer type */
feetVal = Convert.ToInt32(userInput);
Console.Write("Enter height (inches) ");
userInput = Console.ReadLine();
inchVal = Convert.ToInt32(userInput); // once feet has 12 inches

/*totalInches = feetVal * 12 + inchVal; // lets convert the inches to centimeters - once inch roughly is equal to 2.54 centimeters
totalCms = totalInches * 2.54;
heightMeter = (int)totalCms / 100;
heightCm = (int)totalCms % 100; */

totalInches=totalInch(feetVal,inchVal); // calling totalInch() method
totalCms=totalCentimeters(totalInches); // calling totalCentimeters() method
heightMeter=heightMt(totalCms); // calling heightMt() method
heightCm=heightCmt(totalCms); // calling heightCmt() method
show(feetVal,inchVal,heightMeter,heightCm); // calling show() method

/*Console.WriteLine("Input height in (feet and inches) {0} feet {1} inches", feetVal, inchVal);
Console.WriteLine("Input height in (meter and cms) {0} meter {1} cm", heightMeter, heightCm); */
}
}

OUTPUT-1

Enter height (feet): 1

Enter height (inches): 2
Convert Feet and Inches into Meters and Centimeters

Input height in (feet and inches) 1 feet 2 inches
Input height in (meter and cms) 0 meter 35 cm

OUTPUT-2

Enter height (feet): 10

Enter height (inches) : 44
Convert Feet and Inches into Meters and Centimeters

Input height in (feet and inches) 10 feet 44 inches
Input height in (meter and cms) 4 meter 16 cm

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote