Created
October 25, 2013 04:01
-
-
Save JorgeOlvera/7149296 to your computer and use it in GitHub Desktop.
First attempt at java programming
....Output in Shakespearean English, why not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
//Convertir Centigrados a Farenheit, MXN a DLS, y resolver funcion de x// | |
public class ShakespeareanConverter { | |
public static void main(String[] args) throws IOException{ | |
InputStreamReader inStream = new InputStreamReader(System.in); | |
BufferedReader systemIn = new BufferedReader (inStream); | |
String c, f, mxn, dls, x; | |
double numeric_c, numeric_f, numeric_mxn, numeric_dls, numeric_x; | |
//Input Celsius degrees | |
System.out.println ("Greetings, O Mortals! I hath a vast understanding of the fields of physics, economy, and mathematics. Allow me to bestow said knowledge upon thee. \n Hark! Type any temperature in degrees Celsius "); | |
c = systemIn.readLine (); | |
numeric_c = Double.ParseDouble (c); | |
//Celsius to Farenheit Formula | |
double f = C *1.8 + 32; | |
//Output | |
System.out.println ("Bravo!" + c + "degrees Celsius equals" + f + "degrees Farenheit"); | |
//Input Mexican Pesos | |
System.out.println ("Bringeth an amount of Mexican Pesos, and I shall giveth the equivalent amount in Dollars"); | |
mxn = systemIn.readLine (); | |
numeric_mxn = Double.ParseDouble (mxn); | |
//Convert to dollars | |
double dls = numeric_mxn * 0.077; | |
//Output dollars | |
System.out.println(mxn + "mexican pesos is equivalent to " + dls + "Dollars"); | |
//Input x | |
System.out.println("Giveth a value for x, to solve f(x) = x^2 + x + 10: "); | |
x = systemIn.readLine(); | |
numeric_x = Double.parseDouble(x); | |
//Solve for function of x | |
double x = numeric_x; | |
double ans = x * x + x + 10; | |
//Output | |
System.out.println("Hallelujah!" + ans + " is the solution to x^2 + x + 10, assuming x equals" + x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment