Skip to content

Latest commit

 

History

History
85 lines (71 loc) · 3.6 KB

File metadata and controls

85 lines (71 loc) · 3.6 KB

Java-Lab-002

Variables, Types and Operators

Be able to explain what variables are. Understand variable types, allowed names, and valid values. Know how to create and use string, integer, floating-point, and boolean variables.

Part 1 - LikeAGirl.java - Like a Girl

The lab template contains a program that prints the following if you choose "0":

What does it mean to do something, "Like a Girl"?
Show me what it looks like to run, "Like a Girl."
Show me what it looks like to fight, "Like a Girl."
How do you think it affects them when somebody uses "Like a Girl" as an insult? Choice (good: 0, bad: 1) 0
You answered 0
Always wants to change that.
Emotional Damage 100.000000.
Did you answer like a nice person? FALSE

... OR the following if you choose "1":

What does it mean to do something, "Like a Girl"?
Show me what it looks like to run, "Like a Girl."
Show me what it looks like to fight, "Like a Girl."
How do you think it affects them when somebody uses "Like a Girl" as an insult? Choice (good: 0, bad: 1) 1
You answered 1
Good for you.
Emotional Damage 0.000000.
Did you answer like a nice person? TRUE

Ignore the code that you don't fully recognize and concentrate on changing the variables to alter the script to say the following if 1 is chosen:

What does it mean to do something, "Like a Boy"?
Show me what it looks like to run, "Like a Boy."
Show me what it looks like to fight, "Like a Boy."
How do you think it affects them when somebody uses "Like a Boy" as an insult? Choice (good: 1, bad: 2) 1
You answered 1
Good for you.
Emotional Damage 50.000000.
Did you answer like a nice person? TRUE

OR to say the following if 2 is chosen:

What does it mean to do something, "Like a Boy"?
Show me what it looks like to run, "Like a Boy."
Show me what it looks like to fight, "Like a Boy."
How do you think it affects them when somebody uses "Like a Boy" as an insult? Choice (good: 1, bad: 2) 2
You answered 2
Always wants to change that.
Emotional Damage 100.000000.
Did you answer like a nice person? FALSE

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.

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!

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.

Format Specifiers

Part 4 - Submission

  • Just as you did last week (Reference the Lab video in your Week 1 module), create a Feature1 branch of your code
  • Commit your working code to your local copy
  • 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