In Exercises 39 through 44, write a
Simulate a traffic light with three small square text boxes placed vertically on a form. See
Fig. 2.29. Initially, the bottom text box is solid green and the other text boxes are dark gray.
When the Tab key is pressed, the middle text box turns yellow and the bottom text box turns
dark gray. The next time Tab is pressed, the top text box turns red and the middle text box
turns dark gray. Subsequent pressing of the Tab key cycles through the three colors. Hint: First place the bottom text box on the form, then the middle text box, and finally the top text box.
Learn your wayIncludes step-by-step video
Chapter 2 Solutions
Introduction to Programming Using Visual Basic (10th Edition)
Additional Engineering Textbook Solutions
Digital Fundamentals (11th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Artificial Intelligence: A Modern Approach
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Software Engineering (10th Edition)
- Moon effect. Some people believe that the Moon controls their activities. If the Moon moves from being directly on the opposite side of Earth from you to being directly overhead, by what percentage does (a) the Moon's gravitational pull on you increase and (b) your weight (as measured on a scale) decrease? Assume that the Earth-Moon (center-to-center) distance is 3.82 x 10° m, Earth's radius is 6.37 x 106 m, Moon's mass is 7.36 x 1022 kg, and Earth's mass is 5.98 x 1024 kg. (a) Number 6.89 Units percent (b) Number i 6.8713e-4 Units percentarrow_forwardMULTIPLE CHOICE -The answer is one of the options below please solve carefully and circle the correct option Please write clear .arrow_forwardBackground: The town recluse has invited you to dinner at his lavish century-old Victorian mansion outside of town; the dress is formal. When you arrive, you greet and are greeted by the other guests and house staff. After socializing, dinner begins in the dining room underneath the sparkling crystal chandelier with dishes that dazzle every sense. Eventually all the guests, including you, retire to the beautifully appointed and elegant drawing room. You lean back in a comfortable chair to enjoy after dinner refreshments and even better conversation and games. Eventually, despite your best efforts, you fall asleep from all the good food and refreshment. When you wake, you are seated in total darkness and briefly disoriented. Suddenly, a mellifluous voice announces that there is a new game in which you have the chance to win $100,000 simply by finding the bag of cash behind a certain door in the room. Once you have found the money, then you must find the door to the mansion’s corridor.…arrow_forward
- Introduction Some number of teams are participating in a race. You are not told how many teams are participating but you do know that: Each team has a name, which is one of the uppercase letters A-Z. No two teams have the same name, so there are a maximum number of 26 teams. Each team has the same number of members. No two runners cross the finish line at the same time – i.e. there are no ties. At the end of the race we can write the results as a string of characters indicating the order in which runners crossed the finish line. For example: ZZAZAA We can see there were two teams: A and Z. Team A’s runners finished in 3rd, 5th and 6th place. Team Z’s runners finished in 1st, 2nd and 4th place. Scoring the race Each runner is assigned a score equal to their finishing place. In the example above team Z’s runners achieved scores of 1, 2 and 4. Team A’s runners scores were 3, 5, and 6 respectively. The team’s score is the sum of the members score divided by the number of people on…arrow_forwardshould be done in processing languagearrow_forwardTASK 02 Part A The rate of change of a population of bacteria in a petri-dish can be described as the difference between the birth rate and the death rate. If the birth rate = bx, where b is a constant and x is the number of bacteria, and if death rate= px^2, where p is a constant, answer the following questions based on the description provided. 2.A.1) Provide the differential equation related to the rate of change of bacterial population with time based on the above given information. 2.A.2) If b=1, and p=-0.8, solve the differential equation stated in 2.1 using Matlab assuming there were 1500 bacteria present in the dish initially. (Provide a clear screen shot of the code and solution obtained in the answer script) 2.A.3) "ezplot" command is useful to obtain a quick visualization of a function. Plot a graph of the solution using the 'ezplot' command to show the population of bacteria present after 2 hours. 2.A.4) Comment on the state of the population of bacteria after 2 hours using…arrow_forward
- Exercise 4: Write a program (call it MyCounterOptions) as shown in the Figure below. Each time the "Count" button is clicked, the counter value will be changed (incremented or decremented) according to the selected options: counting up or counting down the value of the counting step selected in the ComboBox (increment or decrement by 1, 2, 3, 4 or 5). The button count will consider all options and displays the result accordingly in the counter text field. Swing Counter with RadioButton & ComboBox Counter: O Down Step: 1 Countarrow_forwardThe following program moves a robot in a grid of squares. The initial position and direction of the robot is shown below. Click on the grid to move the robot to the final position after the program is run. You must click within the box to rotate the robot to the correct final direction (click near the top of the box to rotate up, etc...) Feel free to move the robot along as you follow the code. PROCEDURE DoSomething(a){ MOVE_FORWARD() if( a > 2 ) { MOVE_FORWARD() } else { if( a = 3 ) { MOVE_FORWARD() } } MOVE_FORWARD()} i ⬅ 3ROTATE_RIGHT()REPEAT 2 TIMES{ DoSomething(i) MOVE_FORWARD() ROTATE_RIGHT() i ⬅ i - 1}arrow_forwardWrite a program that rotates a Ellipse when the Rotate button is clicked, as shown in Figure 15.26b.arrow_forward
- 8. A game is played by moving a game piece left or right along a horizontal game board. The board consists of spaces of various colors, as shown. The circle represents the initial location of the game piece. Yellow Black Green Green Red Yellow Black Black Yellow Black The following algorithm indicates how the game is played. The game continues until the game is either won by landing on the red space or lost when the piece moves off either end of the board. Step 1: Place a game piece on a space that is not red and set a counter to 0. Step 2: If the game piece is on a yellow space, move the game piece 3 positions to the left and go to step 3. Otherwise, if the game piece is on a black space, move the game piece 1 position to the left and go to step 3. Otherwise, if the game piece is on a green space, move the game piece 2 positions to the right and go to step 3. Step 3: Increase the value of the counter by 1. Step 4: If game piece is on the red space or moved off the end of the game…arrow_forwardMoney Counting Algorithm: Write a program that shows how much the 25 cents, 50 cents and 1 TL coins you put on paper are worth using the size and color information. The algorithm is entirely up to you. Explain the algorithm you developed, add code and images. b) Heads and Tails Detection Algorithm: Write the program that shows whether the coin placed on the paper is heads or tails. Developing the algorithm is entirely up to you. This algorithm should work in three currencies. (If you find a suitable code, etc. somewhere, it is a direct copy. Your codes should be in accordance with the lectures. Put explanations about what you are doing).arrow_forwardne: ID: A 7. A game is played by moving a game piece left or right along a horizontal game board. The board consists of spaces of various colors, as shown. The circle represents the initial location of the game piece. Yellow Black Green Green Red Yellow Yellow Black Black Black The following algorithm indicates how the game is played. The game continues until the game is either won by landing on the red space or lost when the piece moves off either end of the board. Step 1: Place a game piece on a space that is not red and set a counter to 0. Step 2: If the game piece is on a yellow space, move the game piece 3 positions to the left and go to step 3. Otherwise, if the game piece is on a black space, move the game piece 1 position to the left and go to step 3. Otherwise, if the game piece is on a green space, move the game piece 2 positions to the right and go to step 3. Step 3: Increase the value of the counter by 1. Step 4: If game piece is on the red space or moved off the end of the…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr