Conversions & Declarations

  • Answer all questions in prior reviews.
  • Count from 0 to 20 (base 10) in binary.
  • Convert 250 (in base 10) to base 2.
  • Convert 11001100 (base 2) to a decimal value.
  • Declare a variable named code and initialize it to the character X.
  • Declare a variable named mean and initialize it to the value 80.5.
  • Assume you have the character X saved in a variable named code and 80.5 stored in a variable named mean. Write a print statement using println and the variables to print the following:
    • Code: X, Mean: 80.5
  • Assume you have the character X saved in a variable named code and 80.5 stored in a variable named mean. Write a print statement using printf and the variables to print the following:
    • Code: X, Mean: 80.5
  • Declare a variable named middleName and initialize it with the string of characters “Joe”.
  • Assume you have a variable named middleName that holds a string of characters. Write a statement that prints the length of the String.
  • Assume you have a variable named middleName that holds a string of characters. Write a statement that stores the length of the String in a variable named length.
  • Read an integer from the keyboard and store it in a variable named height.
  • Read a floating point value from the keyboard and store it in a variable named area.
  • Read a string from the keyboard and store it in a variable named title.

© 2019 – 2020, Eric. All rights reserved.