Ana
2010-02-28 20:05:29 UTC
These where the instructions from my instructor on how to create the method.
Write a method called convertInchesToFeet
* one parameter: inches
* returns nothing
* the method converts the number of inches to feet and inches
* the method displays the result to the user
o For example, if the method call sends 66 as the value of inches, say "Your are 5 feet and 6 inches tall"
* notice you are outputing the information to the user from inside the method, not returning the value to main
The code is
[code]public static void convertinchestofeet(int inches)
{
int feet = inches / 12;
int pInches = inches % 12;
System.out.println("You are" + feet +"feet and" + pInches + "inches tall.");
}// end ConvertInchesToFeet Method
[/code]
Then the instructions for my main method are:
says "Let's convert inches to feet" then
* prints a blank line
* Asks the user to enter the total number of inches tall he is
* calls the convertInchesToFeet method
my code is [code]
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
System.out.println("Let's convert inches to feet\n");
System.out.print("Enter the total number of inches tall you are:");
int height = scanner.next();
[/code]
Now i have having trouble linking both methods and performing the actions my teachers asks for. Can anybody help me?