Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created October 25, 2013 03:42
Show Gist options
  • Save pepet96/7149147 to your computer and use it in GitHub Desktop.
Save pepet96/7149147 to your computer and use it in GitHub Desktop.
Se hacen las operaciones de conversion principalmente
import java.io.*;
public class mathproblems {
public static void main (String [] args) throws IOException {
InputStreamReader inStream = new InputStreamReader(System.in);
BufferedReader systemIn = new BufferedReader(inStream);
String centigrades, fahrenheit;
double fahrenheitanswer, centigradeanswer;
System.out.println("Please type a value in Centigrades to convert to Fahrenheit: ");
centigrades = systemIn.readLine();
double centigrades_two = Double.parseDouble(centigrades);
fahrenheitanswer = (centigrades_two*9/5 + 32);
System.out.println(centigrades + " centigrades is equal to " + fahrenheitanswer + " fahrenheit.");
String pesos_string;
double pesos, dollars;
System.out.println("Please type a value in Pesos to convert to Dollars: ");
pesos_string = systemIn.readLine();
double pesos_stringdouble = Double.parseDouble(pesos_string);
dollars = (pesos_stringdouble*0.077);
System.out.println(pesos_string + " pesos is equal to " + dollars + " dollars.");
String x;
double x_pow;
System.out.println("Please type a value for x: ");
x = systemIn.readLine();
x_pow = Double.parseDouble(x);
x_pow = Math.pow(x_pow,2)+x_pow+10;
System.out.println("The outcome of the equation is :" + x_pow);
System.out.println("Finalizing Program, Good Bye!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment