Simple Expressions 2

Description

Using basic expressions, display values of different data types

Requirements

  1. Declare a string called team1. Initialize this variable to the name of your sports team. (for example, “Dodgers”)
  2. Declare a string called team2. Initialize this variable to another team name.
  3. Declare an int called score1. Initialize this variable to any integer value.
  4. Declare an int called score2. Initialize this variable to any integer value.
  5. Declare an int called deficit. Set this variable to the difference between score1 and score2. Set this value on a separate line (Do not initialize this variable)
  6. See the sample interaction / output below. Write the code necessary to display this output.
    • Display an opening message on one line such as “World Series 1995”
    • Display team1 vs team2 on one line
    • Display the score as below
    • Display the winner and the deficit amount
  7. Make sure to use the variables 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

World Series 1995
Dodgers vs Rockies
15 to 5
Dodgers Wins by 10!

CATALOG ID: CPP-EXP0002

Print Requirements