Description
Using basic expressions, display values of different data types
Requirements
- Declare a string called movie. Initialize this variable to the name of your favorite movie. (for example, “Back To The Future”)
- Declare a string called title.
- Declare an int called sequence1. Initialize this variable to the number 1
- Declare an int called sequence2. Initialize this variable to the number 2
- Declare a double called price. Initialize this variable to 9.99
- Declare an int called units. Set this variable to the value 2. Set this value on a separate line (Do not initialize this variable)
- Set title to “The Final Episode.” Set this value on a separate line (Do not initialize this variable)
- See the sample interaction / output below. Write the code necessary to display this output.
- Display movie on one line
- Display movie and sequence1 on one line
- Display movie and sequence2 on one line
- Pretend you’re buying two movies each costing 9.99. Calculate the total cost by multiplying price and units. Display this total on one line.
- Remember that you set sequence2 with the value 2 earlier. Display the last line using movie, sequence2, and title (see below). Also, note the hyphen in the output.
- 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
Back To The Future Back To The Future 1 Back To The Future 2 2 movies cost 19.98 Back To The Future 3 - The Final Episode
CATALOG ID: CPP-EXP0001
Print Requirements