goudaman40
<font color=FF33FF>The TF's say 'Hello'<br><font c
- Joined
- Jul 13, 2003
- Messages
- 753
I need major help with a program I am working on - I can get my Convertor.java to compile w/o a problem -
The problem comes when I do my ConvertorTest.java - I am attaching both programs -
Hello all, I had to write a program to convert from fahr to cent; gallons to liters; and dollars to euros.
I got my converter.java to compile without a problem; here is a copy of the program:
public class Convertor
{
public Convertor(int aFahr, int aGal, int aDollar)
{
int tempf = aFahr;
int gallons = aGal;
int dollars = aDollar;
}
public double convertFahrToCent(int tempf)
{
tempf = tempf - 32;
return tempf;
}
public double convertGalToLiter(int gallons)
{
Liter = (gallons * 3.7854118);
return Liter;
}
public double convertDollarToEuro(int dollars)
{
Euro = (dollars * 0.8135);
return Euro;
}
private double tempf;
private double Liter;
private double Euro;
Now here is my problem program - convertortest.java
What am I doing wrong????
javax.swing.JOptionPane;
public class ConvertorTest
{
public static void main(String[] args)
{
final double Fahr_To_Cent = 5.0 / 9.0;
final double Gallons_To_Liters = 3.7854118;
final double Dollars_To_Euros = 0.8135;
String input1 = JOptionPane.showInputDialog(
"Please enter the Fahrenheit degree:");
int tempf = Integer.parseInt(input1);
String input2 = JOptionPane.showInputDialog(
"Please enter the number of Gallons:");
int gallons = Integer.parseInt(input2);
String input3 = JOptionPane.showInputDialog(
"Please enter the amount of Dollars:");
int dollars = Integer.parseInt(input3);
Convertor FahrToCent = new Convertor(tempf);
Convertor gallonsToLiters = new Convertor(gallons);
Convertor dollarsToEuros = new Convertor(dollars);
System.out.println("Fahrenheit to Centrigrade: " * Fahr_To_Cent.Convertor(tempf));
System.out.println("Gallons to Liters: " * Gallons_To_Liters.Convertor(Liters * gallons));
System.out.println("Dollars to Euros: " * Dollars_To_Euros.Convertor(Euros * dollars));
System.exit(0);
}
}
The problem comes when I do my ConvertorTest.java - I am attaching both programs -
Hello all, I had to write a program to convert from fahr to cent; gallons to liters; and dollars to euros.
I got my converter.java to compile without a problem; here is a copy of the program:
public class Convertor
{
public Convertor(int aFahr, int aGal, int aDollar)
{
int tempf = aFahr;
int gallons = aGal;
int dollars = aDollar;
}
public double convertFahrToCent(int tempf)
{
tempf = tempf - 32;
return tempf;
}
public double convertGalToLiter(int gallons)
{
Liter = (gallons * 3.7854118);
return Liter;
}
public double convertDollarToEuro(int dollars)
{
Euro = (dollars * 0.8135);
return Euro;
}
private double tempf;
private double Liter;
private double Euro;
Now here is my problem program - convertortest.java
What am I doing wrong????
javax.swing.JOptionPane;
public class ConvertorTest
{
public static void main(String[] args)
{
final double Fahr_To_Cent = 5.0 / 9.0;
final double Gallons_To_Liters = 3.7854118;
final double Dollars_To_Euros = 0.8135;
String input1 = JOptionPane.showInputDialog(
"Please enter the Fahrenheit degree:");
int tempf = Integer.parseInt(input1);
String input2 = JOptionPane.showInputDialog(
"Please enter the number of Gallons:");
int gallons = Integer.parseInt(input2);
String input3 = JOptionPane.showInputDialog(
"Please enter the amount of Dollars:");
int dollars = Integer.parseInt(input3);
Convertor FahrToCent = new Convertor(tempf);
Convertor gallonsToLiters = new Convertor(gallons);
Convertor dollarsToEuros = new Convertor(dollars);
System.out.println("Fahrenheit to Centrigrade: " * Fahr_To_Cent.Convertor(tempf));
System.out.println("Gallons to Liters: " * Gallons_To_Liters.Convertor(Liters * gallons));
System.out.println("Dollars to Euros: " * Dollars_To_Euros.Convertor(Euros * dollars));
System.exit(0);
}
}