From 525f9745bab2e9d933a5052ada77770a4bc49367 Mon Sep 17 00:00:00 2001 From: fires Date: Sat, 23 Sep 2023 16:57:07 -0700 Subject: [PATCH 1/2] Finished Lab-002 --- .idea/misc.xml | 1 - src/LikeAGirl.java | 29 +++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 03f397c..ca950ab 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/src/LikeAGirl.java b/src/LikeAGirl.java index 30b943b..68c7fc0 100644 --- a/src/LikeAGirl.java +++ b/src/LikeAGirl.java @@ -13,32 +13,32 @@ 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 likeABoy = "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. Scanner s = new Scanner(System.in); System.out.println( - String.format(scriptTemplateLine1, likeAGirl)); + String.format(scriptTemplateLine1, likeABoy)); // Example of using printf and platform specific line separator "%n" to // format instead of String.format - System.out.printf(scriptTemplateLine2, likeAGirl); + System.out.printf(scriptTemplateLine2, likeABoy); - System.out.println(String.format(scriptTemplateLine3, likeAGirl)); + System.out.println(String.format(scriptTemplateLine3, likeABoy)); - System.out.printf(scriptTemplateLine4, likeAGirl, good, bad); + System.out.printf(scriptTemplateLine4, likeABoy, good, bad); int answer = Integer.parseInt(s.nextLine()); @@ -49,7 +49,12 @@ public static void main(String[] args) { ) ); - trueOrFalse = (answer != good); // if answer == 1 (i.e. good), then trueOrFalse should be False + trueOrFalse = (answer != bad); // 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 did not know where to put my comments for section two, so they will go here. The variables we have are int, +// float, double, and boolean. For int the data type is good,bad. For float its emotional damage. For double its also +// emotional damage. For boolean its true or false. For int any integer can be assigned. For float and double its 0-100. +// For boolean its only true or false that can be assigned. Before I changed the code I had to change the word Girl to Boy +// within all the variables that's the only example I can think of. From 294605cf26ee4f259fac7742f992bf01ea8bd89d Mon Sep 17 00:00:00 2001 From: fires Date: Sat, 23 Sep 2023 16:57:43 -0700 Subject: [PATCH 2/2] Finished Lab-002 --- src/LikeAGirl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LikeAGirl.java b/src/LikeAGirl.java index 68c7fc0..7d34a7f 100644 --- a/src/LikeAGirl.java +++ b/src/LikeAGirl.java @@ -57,4 +57,4 @@ public static void main(String[] args) { // float, double, and boolean. For int the data type is good,bad. For float its emotional damage. For double its also // emotional damage. For boolean its true or false. For int any integer can be assigned. For float and double its 0-100. // For boolean its only true or false that can be assigned. Before I changed the code I had to change the word Girl to Boy -// within all the variables that's the only example I can think of. +// within all the variables that's the only example I can think of .