CodeHS Unit 2 Flashcards

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the primary function of the Welcome Program?

  • To print the user's name. (correct)
  • To output current year.
  • To answer user questions.
  • To display ASCII art.

What does the ASCII Art program display?

  • A pattern
  • A cat
  • A dog
  • A shape (correct)

What integer value does the Variables program assign to currYear?

2023

What does the Answering Questions program ask the user?

<p>All of the above (D)</p> Signup and view all the answers

In the Poetry program, what can the user do?

<p>Write a poem (A)</p> Signup and view all the answers

What is calculated in the Area of a Rectangle program?

<p>Area</p> Signup and view all the answers

What must the user input in the Add Fractions program?

<p>Numerators and denominators</p> Signup and view all the answers

What happens to the double value in Casting to Int program?

<p>It gets cast to an int</p> Signup and view all the answers

What type of value does the Casting to Double program output?

<p>A double (A)</p> Signup and view all the answers

In the Movie Ratings program, the movie rating is rounded to the nearest ___

<p>int</p> Signup and view all the answers

The Ice Cream program prints whether the user likes ice cream.

<p>True (A)</p> Signup and view all the answers

What determines if someone can ride in the Roller Coaster program?

<p>Tall enough and old enough</p> Signup and view all the answers

In the Triple Double program, the user is asked for points, rebounds, and ___

<p>assists</p> Signup and view all the answers

Flashcards

Integer Variables

Represent whole numbers (e.g., 10, -5, 0).

String Variables

Store text (e.g., "Hello", "2023").

Double Variables

Hold decimal numbers (e.g., 3.14, -2.5).

Boolean Variables

Store true/false values.

Signup and view all the flashcards

User Input (readLine)

Get text from the user.

Signup and view all the flashcards

Arithmetic Operations

Mathematical calculations (addition, subtraction, etc.).

Signup and view all the flashcards

Type Casting (int to double)

Changing an integer to a decimal.

Signup and view all the flashcards

Type Casting (double to int)

Converting a decimal to a whole number.

Signup and view all the flashcards

Rounding to nearest Integer

Adjusting a decimal to the closest whole number.

Signup and view all the flashcards

Boolean Conditions

Comparisons that evaluate to true or false (e.g., height > 145, age >=12).

Signup and view all the flashcards

Area of a Rectangle

Finding the space inside a rectangle.

Signup and view all the flashcards

Fraction Addition

Calculating the sum of two fractions.

Signup and view all the flashcards

ASCII Art

Image created using text characters.

Signup and view all the flashcards

Study Notes

Welcome Program

  • Introduces a simple class Welcome that extends ConsoleProgram.
  • Outputs personal information using System.out.println().

ASCII Art

  • Class Art illustrates basic ASCII art creation features.
  • Utilizes System.out.println() for visual text representation.

Our First Integer

  • Variables class demonstrates integer usage with int currYear = 2023;.
  • Displays the current year in the console.

Answering Questions

  • Variables class showcases multiple variable types: String, int, double, and boolean.
  • Outputs a best friend's name, a lucky number, room square footage, and ballet participation status.

About You

  • Class AboutYou collects user input for favorite food, color, and movie through readLine().
  • Displays collected input on the console.

Poetry

  • Class Poetry combines static text printing with user-generated content.
  • Prompts user to write a poem and then displays it.

Area of a Rectangle

  • Area class prompts for rectangle dimensions using readDouble().
  • Calculates and displays the area of the rectangle in square units.

Add Fractions

  • Class AddFractions helps compute the sum of two fractions.
  • Uses user input for numerators and denominators, calculates the sum, and formats the output.

Casting to an Int

  • CastingToInt class demonstrates type casting from double to int.
  • Displays the integer value of a double with a truncation feature.

Casting to a Double

  • Class CastingToDouble illustrates type casting from int to double.
  • Computes the quotient of two integers as a double for accurate division.

Movie Ratings

  • Class MovieRatings takes a movie rating from the user.
  • Demonstrates rounding technique to the nearest integer after adding 0.5.

Ice Cream

  • IceCream class gathers user preferences regarding ice cream with a boolean input.
  • Outputs user response directly to the console.

Roller Coaster

  • Class RollerCoaster checks eligibility for riding based on height and age.
  • Combines boolean conditions to determine if the user can ride and outputs the result.

Triple Double

  • Class TripleDouble collects user statistics: points, rebounds, and assists.
  • Intended to use boolean logic for further calculations, although incomplete.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Java Programming Vocabulary Quiz
20 questions
Java Programming Chapters 1-3 Quiz
78 questions
Java Programming Chapter 11 Quiz
8 questions

Java Programming Chapter 11 Quiz

WellConnectedComputerArt avatar
WellConnectedComputerArt
Java Console Applications
24 questions
Use Quizgecko on...
Browser
Browser