Podcast
Questions and Answers
In the function start()
, does the variable hasDog
represent if the user has a dog?
In the function start()
, does the variable hasDog
represent if the user has a dog?
In the function start()
, what does the variable canGraduate
depend on?
In the function start()
, what does the variable canGraduate
depend on?
The variable noSchool
is determined by whether it's a holiday or not a weekday.
The variable noSchool
is determined by whether it's a holiday or not a weekday.
True
What are the two inputs collected in the Rolling Dice
function?
What are the two inputs collected in the Rolling Dice
function?
Signup and view all the answers
What is one of the conditions for achieving gold status in Girl Scout Designation?
What is one of the conditions for achieving gold status in Girl Scout Designation?
Signup and view all the answers
What age defines a teenager according to the provided code?
What age defines a teenager according to the provided code?
Signup and view all the answers
Study Notes
Programming Functions
-
5.1.4 Do You Have A Dog?
- Defines a function
start()
that checks if a person has a dog. - Initializes a variable
hasDog
set tofalse
. - Prints the message with the dog's status.
- Defines a function
-
5.2.6 Can You Graduate?
- Defines a function
start()
to determine if a student can graduate. - Reads two boolean inputs:
hasCredits
for course credits, andgradutionRequirements
for meeting graduation criteria. - Calculates
canGraduate
using logical AND (&&
) to combine both conditions. - Outputs the ability to graduate based on credits and requirements.
- Defines a function
-
5.2.7 School's Out
- Defines a function
start()
that checks if there is school today. - Reads boolean inputs:
weekDay
andholiDay
. - The variable
noSchool
is true if it's a holiday or not a weekday, using logical OR (||
). - Prints whether there is school today based on the conditions.
- Defines a function
Game and Condition Checks
-
5.3.5 Rolling Dice
- The function
start()
prompts for values of two dice. - Uses
readInt
to capture the value ofdieOne
anddieTwo
. - Checks if both dice show the same number to determine if doubles were rolled.
- Outputs the result indicating if doubles were rolled.
- The function
-
5.3.6 Girl Scout Designation
- The function
start()
assesses eligibility for Girl Scout gold status. - Inputs for the number of boxes sold, badges earned, and volunteer hours are captured with
readInt
. - Conditions check whether the number of boxes (≥ 50), badges (≥ 10), and volunteer hours (≥ 25) meet gold status requirements.
- Also, grants gold status if boxes sold are 100 or more.
- Outputs whether the person has gold status based on conditions evaluated.
- The function
Age Verification
-
5.4.7 Teenagers
- The function
start()
checks if a person is classified as a teenager based on age. - It reads an integer to gather the person's age from user input.
- Further logic appears intended but not fully detailed in the note.
- The function
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge with these flashcards from CodeHs Unit 5. Each card features key concepts related to programming functions, such as checking if you have a dog or meeting graduation requirements. Perfect for mastering the basics of coding.