Task 1: Make the program stops after the vehicle passes the signal location by 5 feet. Task 2: Modify the game to give the user a message (using a msgbox) with either a “You won” message if the vehicle arrives during green, or “You lost” if the vehicle arrives during red.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Task 1: Make the program stops after the vehicle passes the signal location by 5 feet.
Task 2: Modify the game to give the user a message (using a msgbox) with either a “You won” message if the
vehicle arrives during green, or “You lost” if the vehicle arrives during red.

I think the language will be javascript 

 

 

A
1 Time Step Accel
2
3
4
5
6
7
8
9
10
11
L2
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
14
45
46
47
48
49
50
51
52
53
54
55
56
51
52
53
54
B
18
18
18
18
с
Speed
683
701
719
737
D
Distance
341.5
350.5
359.5
368.5
E
F
G
Time Step Green Signa Red Signal
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
1
1945W NP
3
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
100
100
100
100
100
100
100
100
100
H
50
45
40
35
30
25
20
15
10
5
0
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
|
Start Eco-drive game
0
J
20
K
40
L
Car Trajectory
60
Distance
80
M
N
100
O
120
Transcribed Image Text:A 1 Time Step Accel 2 3 4 5 6 7 8 9 10 11 L2 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 14 45 46 47 48 49 50 51 52 53 54 55 56 51 52 53 54 B 18 18 18 18 с Speed 683 701 719 737 D Distance 341.5 350.5 359.5 368.5 E F G Time Step Green Signa Red Signal 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1 1945W NP 3 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 100 100 100 100 100 100 100 100 100 H 50 45 40 35 30 25 20 15 10 5 0 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 | Start Eco-drive game 0 J 20 K 40 L Car Trajectory 60 Distance 80 M N 100 O 120
7
·0
0·
A
Project - VBAProject
Solver (Solver.xlam)
VBAProject (Eco drive.xlsm)
Microsoft Excel Objects
Sheet1 (Sheet1)
ThisWorkbook
Forms
UserForm1
UserForm2
Modules
VBAProject (FUNCRES.XLAM)
II
63
(General)
Option Explicit
Public running As Boolean, accel As Single
Private Sub CommandButton1_Click()
running = False
'accel = 0
End Sub
Private Sub CommandButton3_Click()
Dim i As Integer, start As Single
Range("A2:D52").Select
Selection.Clear
running
i = 1
While running
=
Wend
i = i + 1
Wend
End Sub
Cells(i + 2, 1) = i
Cells(i+2, 2) = accel
Cells(i + 2, 3) =
Cells(i+1, 3) + Cells(i + 2, 2)
Cells(i+2, 4) Cells(i+1, 4) + 0.5 * Cells(i + 2, 2)
start Timer
While Timer - start < 1
DoEvents
True
=
Microsoft Visual Basic - Eco drive.xlsm - [UserForm1 (Code)]
Ln 1, Col 1
= True
=
Private Sub CommandButton4_Click()
accel
accel + 1
End Sub
End Sub
Private Sub CommandButton5_Click()
accel accel - 1
End Sub
Private Sub UserForm_Click()
(Declarations)
Transcribed Image Text:7 ·0 0· A Project - VBAProject Solver (Solver.xlam) VBAProject (Eco drive.xlsm) Microsoft Excel Objects Sheet1 (Sheet1) ThisWorkbook Forms UserForm1 UserForm2 Modules VBAProject (FUNCRES.XLAM) II 63 (General) Option Explicit Public running As Boolean, accel As Single Private Sub CommandButton1_Click() running = False 'accel = 0 End Sub Private Sub CommandButton3_Click() Dim i As Integer, start As Single Range("A2:D52").Select Selection.Clear running i = 1 While running = Wend i = i + 1 Wend End Sub Cells(i + 2, 1) = i Cells(i+2, 2) = accel Cells(i + 2, 3) = Cells(i+1, 3) + Cells(i + 2, 2) Cells(i+2, 4) Cells(i+1, 4) + 0.5 * Cells(i + 2, 2) start Timer While Timer - start < 1 DoEvents True = Microsoft Visual Basic - Eco drive.xlsm - [UserForm1 (Code)] Ln 1, Col 1 = True = Private Sub CommandButton4_Click() accel accel + 1 End Sub End Sub Private Sub CommandButton5_Click() accel accel - 1 End Sub Private Sub UserForm_Click() (Declarations)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education