Simple Expressions 2b

Description

Using basic expressions, display values of different data types

Requirements

  1. Declare a string called name. Initialize this variable to “Kobe Bryant”. This will all be on one line.
  2. Declare a string called team. Initialize this variable to “Lakers”
  3. Declare a string called city.
  4. Assign the value “Los Angeles” to city. This will be on a line by itself.
  5. Declare an int called twos. Initialize this variable to 9892 (this is how many two-pointers Kobe made)
  6. Declare an int called threes. Initialize this variable to 1827 (this is how many three-pointers Kobe made)
  7. Declare an int called frees. Initialize this variable to 8378 (this is how many free throws Kobe made)
  8. Declare a double called total
  9. Calculate Kobe’s total accumulated points he shot in  his career. Store this value in total
  10. See the sample interaction / output below. Write the code necessary to display this output.
  11. To calculate his average points-per-shot, perform the calculation directly in the cout statement.
  12. Make sure to use the variables as described above in the display of your output. Do not simply hard-code all the results as string literals

DO NOT USE

You may not use any conditional constructs such as the IF statement

Sample Interaction / Output

Kobe Bryant
Played for Los Angeles Lakers
He scored 33643 points
He averaged 1.674 points per shot

R.I.P Black Mamba

CATALOG ID: CPP-EXP0002b

Print Requirements