程序代写代做代考 Programming Exercise 2-5

Programming Exercise 2-5

# Variables to hold the distances.

distance6Hours = 0.0

distance10Hours = 0.0

distance15Hours = 0.0

# Constant for the speed.

SPEED = 70

# Calculate the distance the car will travel in

# 6, 10, and 15 hours.

distance6Hours = SPEED * 6

distance10Hours = SPEED * 10

distance15Hours = SPEED * 15

# Print the results.

print (“The car will travel the following distances:”)

print (distance6Hours,”miles in 6 hours.”)

print (distance10Hours,”miles in 10 hours.”)

print (distance15Hours,”miles in 15 hours.”)

Start

Declare Real
distance6Hours,

distance10Hours,
distance15Hours

Constant Real
SPEED = 70

Set
distance6Hours =

SPEED * 6

Set
distance10Hours =

SPEED * 10

Set
distance15Hours =

SPEED * 15

A

A

Display “The car
will travel the

following
distances.”

Display
distance6Hours,

“miles in 6
hours.”

Display
distance10Hours

, “miles in 10
hours.”

Display
distance15Hours

, “miles in 15
hours.”

End