diff --git a/.idea/misc.xml b/.idea/misc.xml index 03f397c..5d30da4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index b866789..9e05689 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,27 @@ Take note of the various variables and their data types. Write a brief summary i * Its data type * and example values you can assign them. +ANSWERS: + +Int (bad/good, answer), 1-a lot +Float, emotionaldamage lots of numbers +double, demotionaldamage +boolean, trueOrfalse + + Next give TWO example variable names and TWO example variable assignments that are **WRONG** and explain why. * Hint: your IDE can help you discover wrong assignments or variable names! + +ANSWERS: + +assigning a variable a slightly different name than other instances of the same variable, say I replace the g in good with a capital G, but leave the rest lowercase. +int 2.5, saying integer then making the number a fraction. + +Starting a variable name with a number, the software gets angry when you do this. +Variable names cant have spaces, it will mess with the code. + + ### Part 3 - Bonus: Play around with Java String Format Specifiers. Pick several of the Java format specifiers below and define variables of the correct type utilize **sout** and **String.format** to view the resulting formats. diff --git a/src/LikeAGirl.java b/src/LikeAGirl.java index 30b943b..db4533e 100644 --- a/src/LikeAGirl.java +++ b/src/LikeAGirl.java @@ -15,13 +15,13 @@ public static void main(String[] args) { String scriptTemplateLine5 = "You answered %d%n%s."; String ansGood = "Always wants to change that.%nEmotional Damage %f"; String ansBad = "Good for you.%nEmotional Damage %f"; - String likeAGirl = "Like a Girl"; + String likeAGirl = "Like a boy"; // integer variable - int good = 0; int bad = 1; + int good = 2; // 32 bit floating point variable - float emotionalDamage = 0.0f; // 32 Bit, but it does exist! + float emotionalDamage = 50.0f; // 32 Bit, but it does exist! // double precision floating point variable double dEmotionalDamage = 100.0; // Double precision // boolean variable @@ -53,3 +53,4 @@ public static void main(String[] args) { System.out.printf("Did you answer like a nice person? %B%n", trueOrFalse); } } +