Question: The following are programs expressed as English statements. What would each display on the screen if they were actual programs? 1. The variable x starts

The following are programs expressed as English statements. What would each display on the screen if they were actual programs?

1. The variable x starts with the value 0.

The variable y starts with the value 5.

Add 1 to x.

Add 1 to y.

Add x and y, and store the result in y.

Display the value in y on the screen.

2. The variable a starts with the value 10.

The variable b starts with the value 2.

The variable c starts with the value 4.

Store the value of a times b in a.

Store the value of b times c in c. Add a and c, and store the result in b.

Display the value in b on the screen.

Step by Step Solution

3.33 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 Assuming that these are actual programs they would display the value in y on the sc... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Starting Out With Java From Control Structures Questions!