Cody+Kanger

=Java: US Dollar, Euro, British Pound, Canadian Dollar, Mexican Peso converter=

/** CurrencyConverter.java converts kilometers to miles. * @author Cody Kanger * @version for Alice=Java book. */ import java.util.Scanner; public class CurrencyConverter { public static void main(String[] args) { System.out.println("This program will allow you to convert currencys between the US Dollar, the Euro, the British Pound, "); System.out.println(" the Canadian Dollar, and the Mexican Peso. Which currency are you starting with? "); System.out.println(" A) US Dollar"); System.out.println(" B) Euro"); System.out.println(" C) British Pound"); System.out.println(" D) Canadian Dollar"); System.out.println(" E) Mexican Peso"); // Each line was written out println so it would list it so its easier to see and use when running the program. Scanner kbd = new Scanner(System.in); // This tells program to look for the key board String answer = kbd.next; // This is the first variable. This answer provided by the user will tell the computer which lines of code to use and which to avoid in the IF ELSE statement. if (answer.equalsIgnoreCase("A")){ // This line of code is if the user wants to convert from US Dollars. System.out.print("Please enter the amount of US Dollars you want to convert: "); Scanner kbd1 = new Scanner(System.in); // This is the second variable, it is the number the user types in to allow the program to do the calculations through the conversions. double A = kbd1.nextDouble; // Second variable assignment. double Euro = A * .75466; // These next lines are basically the same throughout the program, one line changes depending on the conversion. double Pound = A * .639952; double CanadianDollar = A * 1.02453; double Peso = A * 13.7846; System.out.printf("%.2f US Dollars => %.2f Euros, %.2f British Pounds, %.2f Canadian Dollas, %.2f Mexican Pesos", A, Euro, Pound, CanadianDollar, Peso); } else { if (answer.equalsIgnoreCase("B")){ // This is same line of code, just adjsuted currency rates for Euros. System.out.print("Please enter the amount of Euros you want to convert: "); Scanner kbd2 = new Scanner(System.in); double B = kbd2.nextDouble; double USDollar = B * 1.32510; double Pound = B * .848000; double CanadianDollar = B * 1.35760; double Peso = B * 18.2659; System.out.printf("%.2f Euros => %.2f US Dollars, %.2f British Pound, %.2f Canadian Dollars, %.2f Mexican Pesos", B, USDollar, Pound, CanadianDollar, Peso); } else { if (answer.equalsIgnoreCase("C")){ // Same line of code, only differences is for currency rates for British Pound. System.out.print("Please enter the amount of British Pounds you want to convert: "); Scanner kbd3 = new Scanner(System.in); double C = kbd3.nextDouble; double USDollar = C * 1.56261; double Euro = C * 1.17924; double CanadianDollar = C * 1.60094; double Peso = C * 21.5400; System.out.printf("%.2f British Pounds => %.2f US Dollars, %.2f Euros, %.2f Canadian Dollars, %.2f Mexican Pesos", C, USDollar, Euro, CanadianDollar, Peso); } else { if (answer.equalsIgnoreCase("D")){ // Again same line of code, only differences are for currency rates for Canadian Dollar. System.out.print("Please enter the amount of Canadian Dollars you want to convert: "); Scanner kbd3 = new Scanner(System.in); double D = kbd3.nextDouble; double USDollar = D * .976057; double Euro = D * .736591; double Pound = D * .624629; double Peso = D * 13.4545; System.out.printf("%.2f Canadian Dollars => %.2f US Dollars, %.2f Euros, %.2f British Pounds, %.2f Mexican Pesos", D, USDollar, Euro, Pound, Peso); } else { System.out.print("Please enter the amount of Mexican Pesos you want to convert: "); // Final line of code for Pesos. Scanner kbd5 = new Scanner(System.in); double Pesos = kbd5.nextDouble; double USDollar = Pesos * .072544; double Euro = Pesos * .054746; double Pound = Pesos * .046425; double CanadianDollar = Pesos * .074324; System.out.printf("%.2f Mexican Pesos => %.2f US Dollars, %.2f Euros, %.2f British Pounds, %.2f Canadian Dollars", Pesos, USDollar, Euro, Pound, CanadianDollar); // This line of code is the same for each of the five statements, this is the final line which prints the calculations the computer performed. } } } } } } = = =Java: Mi to Km or Km to Mi=

/** KilometersToMiles.java converts kilometers to miles. * @author Cody Kanger * @version for Alice=Java book. */ import java.util.Scanner; public class KilometersMilesConverter { public static void main(String[] args) { System.out.print("Would you like to convert Kilometers to Meters True/False? "); Scanner kbd = new Scanner(System.in); String answer = kbd.next; if (answer.equalsIgnoreCase("true")){ System.out.print("Please enter the kilometers to be converted to miles: "); //This tells the program to put this message on the screen so the operator can read and respond. Scanner kbd1 = new Scanner(System.in);// This tells the program that something, the keyboard, is going to be used to give some numeric variable from the operator. double kilometers = kbd1.nextDouble; //This allows the program to see or use the variable that the operator gives using the tool, the keyboard. double miles = kilometers * .621371192;// The math hear is the meat and potatoes. This tells the program to multiple the number the operator gave, the variable, by this specific number .6... System.out.printf("%.1f kilometers => %.1f miles", kilometers, miles); //This is the final line which commands the program to give the operator its answer to the previous mathematical equation. The %.1f tells the computer to only display one figure past the decimal, because cars usually only give one past too. } else { System.out.print("Please enter the miles to be converted to kilometers: ");// This tells the program to put this message on the screen so the operator can read and respond. Scanner kbd1 = new Scanner(System.in); //This tells the program that something, the keyboard, is going to be used to give some numeric variable from the operator. double miles = kbd1.nextDouble;// This allows the program to see or use the variable that the operator gives using the tool, the keyboard. double kilometers = miles * 1.609344; //The math hear is the meat and potatoes. This tells the program to multiple the number the operator gave, the variable, by this specific number .6... System.out.printf("%.1f kilometers => %.1f miles", miles, kilometers);// This is the final line which commands the program to give the operator its answer to the previous mathematical equation. The %.1f tells the computer to only display one figure past the decimal, because cars usually only give one past too. } } } = = = = = = = = = = = = = = = = = = = Project is on Student Drive:Cody Kanger: Where's Alice?= = = = = ==

THIS ONE ! ! ! = = = = = = = = = = = = = = == = = = = = = == = =








 * ^  ||^   ||   || **cuckooClock.leftDoor** **turn** **left** **0.25** revolutions || **cuckooClock.rightDoor** **turn** **right** **0.25** revolutions ||
 * ^  ||^   ||   || **cuckooClock.leftDoor** **turn** **left** **0.25** revolutions || **cuckooClock.rightDoor** **turn** **right** **0.25** revolutions ||
 * ^  ||^   ||   || **cuckooClock.leftDoor** **turn** **left** **0.25** revolutions || **cuckooClock.rightDoor** **turn** **right** **0.25** revolutions ||
 * ^  ||^   ||   || **cuckooClock.leftDoor** **turn** **left** **0.25** revolutions || **cuckooClock.rightDoor** **turn** **right** **0.25** revolutions ||


 * **cuckooClock.doorsC** //No variables// ||
 * |||||| **Do in order** ||
 * ^  ||   |||| **Do together** ||
 * ^  ||^   ||   || **cuckooClock.leftDoor** **turn** **right** **0.25** revolutions || **cuckooClock.rightDoor** **turn** **left** **0.25** revolutions ||


 * **cuckooClock.cuckooMove** ( [ABC] **yesOrNo**) //No variables// ||
 * |||||||| **Do in order** ||
 * ^  ||   |||||| **Wait** **0.25** seconds |||||| **//** **Cuckoo must move half distance before whole cuckoo system moves so the arm and cuckoo look connected.** |||||| **cuckooClock.cuckoo** **move** **forward** **0.23** meters style = **end gently** duration = **1** second |||||| **Do together** ||   |||| **cuckooClock.cuckoo** **move** **forward** **0.23** meters style = **end gently** duration = **0.5** seconds |||| **cuckooClock.arm** **move** **forward** **0.2** meters style = **end gently** duration = **0.5** seconds |||| **Do together** ||   || **cuckooClock.cuckoo** **move** **backward** **.465** meters style = **begin gently** duration = **1.5** seconds || **cuckooClock.arm** **move** **backward** **0.2** meters style = **begin gently** duration = **1** second ||


 * **cuckooClock.clockRun** //No variables// ||
 * |||||||||| // **This part is to set the clock.** // |||||||||| **Do in order** ||  |||||||| **Do together** ||   |||||| **Loop** **infinity** times **times** ||   |||| **Do together** ||   || **cuckooClock.minuteHand** **roll** **left** **0.02** revolutions duration = **1** second style = **abruptly** **0.02** revolutions duration = **1** second style = **abruptly** || **Revolution is 1/60 (60 minutes in one revolution) per one second.** |||||| **Loop** **infinity** times **times** ||   |||| **cuckooClock.hourHand** **roll** **left** **0.08** revolutions duration = **60** seconds style = **abruptly** **0.08** revolutions duration = **60** seconds style = **abruptly** |||| **//** **Revolution is 1/12(12 hours in one revolution.)** ||


 * **cuckooClock.setClock**
 * setHour** **=** **0.08** **,** **setMin** **=** **0.02** ||
 * |||| **Do in order** ||
 * ^  ||   || **cuckooClock.hourHand** **roll** **left** ( **(** **setHour** * ( **ask user for a number** question = **Enter Hour:** ) **)** ) || **cuckooClock.minuteHand** **roll** **left** ( **(** **setMin** * ( **ask user for a number** question = **Enter Minute:** ) **)** ) ||