From cfbc7b032acd8c25c51280510b7185752c1bce0d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 1 Sep 2023 16:39:52 -0700 Subject: [PATCH] Changed values according to readme instructions --- .idea/misc.xml | 2 +- README.md | 17 +++++++++++++---- src/LikeAGirl.java | 17 +++++++++-------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 03f397c..f34ceba 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..6592777 100644 --- a/README.md +++ b/README.md @@ -52,15 +52,24 @@ Always wants to change that. Emotional Damage 100.000000. Did you answer like a nice person? FALSE ``` - -### Part 2 - Interpretation +Part 2 - Interpretation Take note of the various variables and their data types. Write a brief summary in this section of the README.md file listing the: * Variable name * Its data type -* and example values you can assign them. +* and example values you can assign them.

+//
+ansBad - String - any sequence of characters
+bad - int - any integer (whole number) +
//
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! +* Hint: your IDE can help you discover wrong assignments or variable names!

+ //
+ int number = 8;
+ (wrong: 8 = number)

+ String example = ("random text");
+ (wrong: example String =("random text")); +
//
### Part 3 - Bonus: Play around with Java String Format Specifiers. diff --git a/src/LikeAGirl.java b/src/LikeAGirl.java index 30b943b..d12c0bf 100644 --- a/src/LikeAGirl.java +++ b/src/LikeAGirl.java @@ -13,17 +13,17 @@ public static void main(String[] args) { String scriptTemplateLine4 = "How do you think it affects them when somebody uses \"%s\" as an insult? Choice (good: %d, bad: %d) "; 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 ansBad = "Always wants to change that.%nEmotional Damage %f"; + String ansGood = "Good for you.%nEmotional Damage %f"; + String likeAGirl = "Like a Boy"; // integer variable - int good = 0; - int bad = 1; + int good = 1; + int bad = 2; // 32 bit floating point variable - float emotionalDamage = 0.0f; // 32 Bit, but it does exist! + float emotionalDamage = 100.0f; // 32 Bit, but it does exist! // double precision floating point variable - double dEmotionalDamage = 100.0; // Double precision + double dEmotionalDamage = 50.0; // Double precision // boolean variable boolean trueOrFalse; // Scanner variable for reading input. @@ -49,7 +49,8 @@ public static void main(String[] args) { ) ); - trueOrFalse = (answer != good); // if answer == 1 (i.e. good), then trueOrFalse should be False + trueOrFalse = (answer == good); // if answer == 1 (i.e. good), then trueOrFalse should be False System.out.printf("Did you answer like a nice person? %B%n", trueOrFalse); +//I tried to get the String Format Specifiers working to no avail. I'm excited to get working with them though! } }