Calling Methods Again [so, are you guys sick of me yet?]
So! I finally think I understand writing a method! ...of course...I
still can't seem to figure out how to call it right, and therefore I
don't know if the method is right *if that made any sense*.
This is what I have so far *hides*:
/**
* @(#)try1.java
*
* try1 application
*
* @author
* @version 1.00 2008/4/1
*/
import java.util.*;
import javax.swing.*;
import java.io.*;
public class try1 {
public static void main(String[] args)throws FileNotFoundException
{
Scanner fileIn = new Scanner(new FileReader("Cylinders.txt"));
PrintWriter fileOut = new PrintWriter("Output3.txt");
System.fileOut.print("Please Enter The Radius: ");
float radius = fileIn.nextFloat();
System.fileOut.print("Please Enter The Height: ");
float height = fileIn.nextFloat();
System.fileOut.println("Height= " + height + ", Radius= " + radius +
", Base Area= " + area + ", Lateral Area= " + latArea + ", Surface
Area= " + surfArea + ", Volume= " + volume);
}
public static float baseArea(float radius){
float area;
area = 3.14*radius*radius;
return area;
}
public static float latArea(float radius, float height){
float circum = (radius*2)*3.14;
latArea = circum * height;
return latArea;
}
public static float surfArea(float area, float latArea){
float surfArea = (area*2)+latArea;
return surfArea;
}
public static float volume(float area, float height){
float volume = area*height;
return volume;
}
fileIn.close();
fileOut.close();
}