diff --git a/.idea/misc.xml b/.idea/misc.xml index 03f397c..cf9abe6 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..4c1b993 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,19 @@ 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. -Next give TWO example variable names and TWO example variable assignments that are **WRONG** and explain why. +**A few variable types found in LikeAGirl.java** +* scriptTemplateLine1 is a String (non-primitive), the types of values you can assign to a string are a string of characters +* good is an int or integer (primitive) and can be assigned a value of single digit integer such as 1 +* emotionalDamage is a float (primitive) and can be assigned a value of a digit with a decimal point but must include a "f" after the number +* dEmotionalDamage is a double (primitive) and can be assigned a value of digit with a decimal point +* trueOrFalse is a boolean (primitive) and can have a value of true or false + + +* Next give TWO example variable names and TWO example variable assignments that are **WRONG** and explain why. + +1. **int 1dayOfYear = 365.0; is wrong because you can not start a name with a number and the value has a decimal and is either a float or a double** +2. **boolean isItTrue! = yes; is wrong because you can not use an explanation mark in a name and a boolean data type can only produce a value of true or false** + * Hint: your IDE can help you discover wrong assignments or variable names! ### Part 3 - Bonus: Play around with Java String Format Specifiers. diff --git a/src/LikeAGirl.java b/src/LikeAGirl.java index 30b943b..544747d 100644 --- a/src/LikeAGirl.java +++ b/src/LikeAGirl.java @@ -1,5 +1,11 @@ import java.util.Scanner; +/** + * @author Trevor Hartman + * @author MJ Fracess + * + * @since Version 1.0 + */ public class LikeAGirl { /** * "Like a Girl," Super Bowl XLIX (2015) - Like a Girl @@ -15,17 +21,23 @@ 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"; //changed from "Like a Girl" + String bonusAttempt = "Do you like bonus points? \"%s\"!"; + String bonusSecondAttempt = "Do you like good grades, \"%s\"!"; + String whatDoYouLike = "You know it"; + String Question = "Are you sure?"; + // 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 = 50.0f; // 32 Bit, but it does exist! Changed from original value of 0.0f // double precision floating point variable double dEmotionalDamage = 100.0; // Double precision // boolean variable boolean trueOrFalse; + // Scanner variable for reading input. Scanner s = new Scanner(System.in); @@ -44,12 +56,22 @@ public static void main(String[] args) { System.out.println( String.format(scriptTemplateLine5, answer, - (answer == good) ? + (answer == bad) ? String.format(ansGood, dEmotionalDamage) : String.format(ansBad, emotionalDamage) ) ); - trueOrFalse = (answer != good); // if answer == 1 (i.e. good), then trueOrFalse should be False + trueOrFalse = (answer != bad); // if answer == 2 (i.e. bad), then trueOrFalse should be False System.out.printf("Did you answer like a nice person? %B%n", trueOrFalse); + System.out.println( + String.format(bonusAttempt, whatDoYouLike)); + System.out.println( + String.format(bonusSecondAttempt, whatDoYouLike)); + System.out.println(Question); + System.out.print(dEmotionalDamage); + + + + } }