Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,12 @@ Pick several of the Java format specifiers below and define variables of the cor
* Push it to your Remote/origin branch (i.e. GitHub: Feature1 -> origin/Feature1)
* Then issue a Pull request to my instructor branch
* Make sure to **COPY** the Pull request URL and submit it for the lab/assignment.

# Summary
The variable name would be the String scriptTemplateLines and the values can be, "What does it mean to do something, "Like a Girl"?".
or any other stings it states. The data type would be strings which is a sequence of characters.
I think the "You answered 1" has the true or false variable. It gives the data type boolean and creates the value
"Good for you." or "Always wants to change that." depending on the input. I'm sort of getting it.
Hey


107 changes: 54 additions & 53 deletions src/LikeAGirl.java
Original file line number Diff line number Diff line change
@@ -1,55 +1,56 @@
import java.util.Scanner;

public class LikeAGirl {
/**
* "Like a Girl," Super Bowl XLIX (2015) - <a href="https://www.youtube.com/watch?v=5yLXrWLvwAo">Like a Girl</a>
* @param args Command line arguments [The source file path, The target file path, ...]
**/
public static void main(String[] args) {
// String variables, some with format specifiers
String scriptTemplateLine1 = "What does it mean to do something, \"%s\"?";
String scriptTemplateLine2 = "Show me what it looks like to run, \"%s.\"%n";
String scriptTemplateLine3 = "Show me what it looks like to fight, \"%s.\"";
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";

// integer variable
int good = 0;
int bad = 1;
// 32 bit floating point variable
float emotionalDamage = 0.0f; // 32 Bit, but it does exist!
// 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);

System.out.println(
String.format(scriptTemplateLine1, likeAGirl));

// Example of using printf and platform specific line separator "%n" to
// format instead of String.format
System.out.printf(scriptTemplateLine2, likeAGirl);

System.out.println(String.format(scriptTemplateLine3, likeAGirl));

System.out.printf(scriptTemplateLine4, likeAGirl, good, bad);

int answer = Integer.parseInt(s.nextLine());

System.out.println(
String.format(scriptTemplateLine5, answer,
(answer == good) ?
String.format(ansGood, dEmotionalDamage) : String.format(ansBad, emotionalDamage)
)
);

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);
}
}
public class LikeAGirl {
/**
* "Like a Girl," Super Bowl XLIX (2015) - <a href="https://www.youtube.com/watch?v=5yLXrWLvwAo">Like a Girl</a>
*
* @param args Command line arguments [The source file path, The target file path, ...]
**/
public static void main(String[] args) {
// String variables, some with format specifiers
String scriptTemplateLine1 = "What does it mean to do something, \"%s\"?";
String scriptTemplateLine2 = "Show me what it looks like to run, \"%s.\"%n";
String scriptTemplateLine3 = "Show me what it looks like to fight, \"%s.\"";
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 Boy";

// integer variable
int bad = 1;
int good = 2;
// 32 bit floating point variable
float emotionalDamage = 0.0f; // 32 Bit, but it does exist!
// double precision floating point variable
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));

// Example of using printf and platform specific line separator "%n" to
// format instead of String.format
System.out.printf(scriptTemplateLine2, likeAGirl);

System.out.println(String.format(scriptTemplateLine3, likeAGirl));

System.out.printf(scriptTemplateLine4, likeAGirl, good, bad);

int answer = Integer.parseInt(s.nextLine());

System.out.println(
String.format(scriptTemplateLine5, answer,
(answer == good) ?
String.format(ansGood, dEmotionalDamage) : String.format(ansBad, emotionalDamage)
)
);

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);
System.out.println(String.format(scriptTemplateLine4, likeAGirl, 1, 2));
}
}