/* Example code from Sept 2 */ package sept2test; import java.util.Scanner; /** * * @author jcmtiernan */ public class Sept2Test { /** * @param args the command line arguments */ public static void main(String[] args) { // Test code Scanner input = new Scanner(System.in); int myValue; int secondValue; double floatingPointValue, secondFLValue; byte smallValue; boolean twoValue; int strLength; int strEO; String str1 = "This is CSE 1310 class on Thursday 10 Sept 2015"; String str2 = new String(); String str3; String str4; int int4; double doub4; System.out.println(str1); System.out.println("**"+str2+"**"); System.out.print("Please enter a line of input that contains one integer and 1 double: "); str3 = input.next(); str4= input.next(); //str3 = str3.substring(5, 5); System.out.println("You entered string "+str3+" "+str4); int4 = Integer.parseInt(str3); doub4 = Double.parseDouble(str4); System.out.println("From the string *"+str3+ "* we parsed "+int4+" and we add 1 to get "+(int4 + 1)+ " and we added 1 to the string and got "+(str3+1) ); System.out.println("From the string *"+str4+ "* we parsed "+doub4+" and we add 1 to get "+(doub4 + 1)+ " and we added 1 to the string and got "+(str4+1) ); /* StrLength = str3.length(); System.out.println("THe string length is "+strLength); strEO = strLength % 2; // save 0 or 1 for even or odd if (strEO == 0) { System.out.println("THe length of the string is even"); } else if (strLength > 6) { System.out.println("THe length of the string is odd and longer than 6"); } else { System.out.println("THe length of the string is odd and shorter than 6"); } */ /* System.out.print("Please enter an integer: "); myValue = input.nextInt(); System.out.print("Now enter a" +"floating point number: "); floatingPointValue = input.nextDouble(); System.out.print("Please enter a byte value: "); smallValue = input.nextByte(); System.out.println("Now we compare "+myValue+" and "+floatingPointValue+" to get a boolean value: "); twoValue = (myValue != floatingPointValue); secondValue = 9; secondFLValue = secondValue/floatingPointValue; */ //System.out.println("Result of 9 / FLValue is: "+secondFLValue); //System.out.println("Y'all are awesome!"); //System.out.print("You are a perfect "); //System.out.println((6+4)/myValue); //System.out.println("The input values were "+myValue+" and "+floatingPointValue); //System.out.println("The byte and boolean are "+smallValue+" and "+twoValue); } }