Concept explainers
Tic-Tac-Toe Simulator
Create an application that simulates a game of tic-tac-toe. Figure 7-45 shows an example of the application’s form. The form shown in the figure uses eight large Label controls to display the Xs and Os.
Figure 7-45 The Tic-Tac-Toe application
The application should use a two-dimensional int array to simulate the game board in memory. When the user clicks the New Game button, the application should step through the array, storing a random number in the range of 0 through 1 in each element. The number 0 represents the letter O, and the number 1 represents the letter X. The form should then be updated to display the game board. The application should display a message indicating whether player X won, player Y won, or the game was a tie.
Learn your wayIncludes step-by-step video
Chapter 7 Solutions
EBK STARTING OUT WITH VISUAL C#
Additional Engineering Textbook Solutions
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Electric Circuits. (11th Edition)
Database Concepts (8th Edition)
Mechanics of Materials (10th Edition)
Concepts Of Programming Languages
- The intSales array is declared as follows: Dim intSales() As Integer = {10000, 12000, 900, 500, 20000}. The statement intSales (2) += 10 will _____. replace the 900 amount with 10 replace the 900 amount with 910 replace the 12000 amount with 10 replace the 12000 amount with 12010arrow_forwardFor each of the following exercises, you may choose to write a console-based or GUI application, or both. Write a program named CheckZips that is used by a package delivery service to check delivery areas. The program contains an array that holds the 10 zip codes of areas to which the company makes deliveries. Prompt a user to enter a zip code, and display a message indicating whether the zip code is in the companys delivery area.arrow_forwardOpen the Calories Solution.sln file contained in the VB2017\Chap08\Calories Solution folder. Open the Code Editor window and locate the btnDisplay_Click procedure. The procedure declares and initializes a one-dimensional array named intCalories. The array stores the numbers of daily calories consumed. The procedure should calculate and display the average number of calories consumed; use the Math.Round method to round the average to an integer. (You learned about the Math.Round method in Chapter 6.) The procedure should also display the number of days in which the daily calories were greater than the average, the number of days in which the daily calories were the same as the average, and the number of days in which the daily calories were less than the average. Code the procedure. Save the solution and then start and test the application.arrow_forward
- Using C# in Microsoft Visual Studio Create an application that simulates a game of tic-tac-toe. The application should use a two-dimensional int array to simulate the game board in memory. When the user clicks the New Game button, the application should step through the array, storing a random number in the range of 0 through 1 in each element.The number 0 represents the letter O, and the number 1 represents the letterX. The form should then be updated to display the game board. The application should display a message indicating whether player X won, player Y won, or the game was a tie.arrow_forwardDesign an application that declares an array of 20 AutomobileLoan objects. Prompt the user for data for each object, and then display all the values.arrow_forward10. The intSales array is declared as follows: Dim intSales(,) As Integer = {{1000, 1200, 900, 500, 2000}, {350, 600, 700, 800, 100}}. The intSales(1, 3) = intSales(1, 3) + 10 statement will _______________a) replace the 900 amount with 910b) replace the 500 amount with 510c) replace the 700 amount with 710d) replace the 800 amount with 810arrow_forward
- In visual basic Create an array that will hold 10 integer values.arrow_forwardTrue or False Topic: Visual Basic a. Each array element has a unique subscript (or index) assigned to it. indexing assignment begins at 1. b. Every element in the array must be the same data type.arrow_forwardMenu Item Description Add Dog 1) Asks the user for all the state value information for a dog. 2) Checks if there is space in the array to hold the new dog. 3) Check that the dogld is not already used in the system. 4) Creates a new Dog object and adds it to the array if there is space. If the array is full, print "Sorry... the Shelter is Full!". Note: All new dogs have no home as yet (foundHome = false). View all dogs This menu option shows all dogs in the system. This includes dogs that have a home and those that do not. View all available dogs Shows all dogs in the system, which have no homes as yet. View a specific dog 1) Asks the user for a dogld. 2) Searches for a dog at the shelter with that dogld. 3) Displays the information of the dog associated with that dogld if found. If the dog is not found, "There is no dog with that id.." must be displayed. Update dog home status 1) Asks the user for a dogld. 2) Searches for a dog at the shelter with that dogld 3) If a dog with that id is…arrow_forward
- Assignment #2 Design an application to search in a database table of employee records. Each employee record consists of an ID, first name, last name, job title. The user interface should look similar to the sketch shown below. A text field is used to input the search query. A combo box is used to choose the search criteria (e.g. search by ID, search by first name, search by last name). By choosing any criteria and clicking on the "search" button, the correct results should be shown on the "results" pane. Search Query Search criteria Search Results Item1 Item2 Item3 otes E Notes Comments 2:38 PM ENG 3/8/202arrow_forwardYou are working for a company that developed a new drug which increases HDL cholesterol (the good cholesterol). A variety of dosages were given to participants during a trial, and the increases of HDL cholesterol were measured. This information is summarized in the following plot: Dosage vs Increase 80 70 60 50 40 30 20 10 15 x - dosage in mg 10 20 25 30 Each point (x, y) in the above plot represents a participant who was given a dosage of æ mg and had an HDL increase of y mg/dL. This information is stored in the 2d numpy array trial_data. The r-values are stored in the first row of trial_data (i.e. trial_data[@]) and the y-values are stored in the second row of trial_data (i.e. trial_data[1]). You are now working with a physician to determine the right dosage for one of her patients. 1) In order to help your client, first find a vector B = [B1] such that y(x) = B1 + Bza is the least squares line [B2] for the above data. Store the vector B as a 1D-numpy array in beta. 2) The physician…arrow_forwardThe logic will allow the user to: Load a single dimensional array of size 50 with a random number The random number will range from 1 to 1,000 (you may have duplicate values) Find the highest value and the index location that it was in Find the smallest value and the index location that it was in Display the array’s contents. Display the highest value and its index location Display the lowest value and its index location Allow the user to execute this application multiple times (some sort of loop?) You will need one for loop to load the array as well as one or two for loops to search that array. The rand also has a “nasty” tendency to create the same results repeatedly in an exe. To avoid that, we have to “shuffle the deck” every time. This ensures that all numbers are an equal probability of appearing and not the same set of values (would create a boring game). // Add this to "shuffle the deck" every time to ensure that // different values could occur else the exe produces the…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning