Design a roulette wheel which allows the user to enter bets on multiple numbers. Allow the user to stop
betting when they enter 0 on a bet. The program will then choose a random number between 0 and 36.
If the user wins, they will get back 30 times the amount they bet on that number. The program will print
out the winning number as well as how much they won or lost.
Create an array to store the numbers the user bet on.
Create a corresponding array to store the amount they bet on each number.
o int[] bets=new int[36];//To store the person's bets
o int[] amount =new int[36];//To store the amount of the bet
Ask them what numbers they want to bet on and how they want to bet. Store these in the arrays.
The program chooses a winning random number.
Check to see if any of their bets match the correct number.
If they have the correct number tell them this and inform them as to how much they won or lost.
If they did not get the correct number tell them this and tell them how much they lost.
Print the winning number
Program 3: (Based on arrayhw4 in the chapter 7 project).
Create your own SAT exam.
There will be three sections, each section will have a corresponding array for the true answers and an
array to store the student’s answers. Each section has 5 questions.
Example-For section 1:
char[] answers1 = {'A','C','A','D','E'}; //correct answers
char[] sanswers1 = new char[answers1.length]; //to store the student’s answers
Scoring is done as follows:
Base score is 200
For each correct answer in section 1 they get 20 points. For each incorrect answer 5 points is
deducted.
For each correct answer in section 2 they get 40 points. For each incorrect answer 10 points is
deducted.
For each correct answer in section 3 they get 60 points. For each incorrect answer 15 points is
deducted.
Ask the questions
Compute the score
o If their score is less than 200 give them a score of 200
Step by stepSolved in 4 steps with 2 images
- • • Asks the user for their name and store it in an array Asks the user for their age and store it in a variable Determines how many years before they can retire at age 67. If user is 67 then it will indicate that the user should retire now. If user is over 67 it will indicate that the user should have already retired If the user is under 67 then it will indicate number of years before retirement Ends with a thank you message. Example of Output Welcome to nameage Please enter name: (user enters a value like Pat) Please enter your age: (user enters a value like 69) Hi Pat. You should already be retired. Thank you for using nameage. Bye!arrow_forwardThe intNum array is declared as follows: Dim intNum(,) As Integer = {{6, 12, 9, 5, 2}, {35, 60, 17, 8, 10}}. The intNum(1, 4) = intNum(1, 2) - 5 statement will _____________________. a. replace the 10 amount with 12 b. replace the 5 amount with 7 c. replace the 2 amount with 4 d. None of the above.arrow_forward2.B) Create an application containing an array that stores 20 prices, such as $2.34, $7.89, $1.34, and so on. The application should (1) display the sum of all the prices, (2) display all values less than $5.00, (3) calculate the average of the prices, and (4) display all values that that are higher than the calculated average value Save the file as Prices.javaarrow_forward
- When using two loops to traverse an array, you can use the For...Next statement to code the outer loop and use the For Each...Next statement to code the nested loop. True or False?arrow_forwardJAVA based programarrow_forwardCreate an array called sales to monitor one week's worth of sales over the course of two months. Assign sales data to the array's elements. Then, in a loop, compute the average sales for the one week of each of the two months that are recorded in the array.arrow_forward
- TicTacToeCreate the board display the board Set token to ‘x’Loop //at most 9 times, but end loop when someone wins{ Ask player where to place token display the board Checks if won Change token (if it was ‘x’ change to ‘o’ and vice versa)}Either congratulate someone on winning or say it was a draw. Create a 17x17 array of characters and put ‘ ‘ in each element.2. Write a loop to make the first horizontal line, and another to do the second horizontal line3. Write a loop to make the first vertical line, and another to create the second vertical line4. Put in the numbers (this is so the player can choose where to put the token). You will need 9 separate assignment statements.arrow_forwardThe intNum array is declared as follows: Dim intNum(,) As Integer = {{6, 12, 9, 5, 2}, {35, 60, 17, 8, 10}}. Which of the following If clauses determines whether the intRow and intCol variables contain valid row and column subscripts, respectively, for the array? a. If intNum(intRow, intCol) >= 0 AndAlso intNum(intRow, intCol) < 5 Then b. If intNum(intRow, intCol) >= 0 AndAlso intNum(intRow, intCol) <= 5 Then c. If intRow >= 0 AndAlso intRow < 3 AndAlso intCol >= 0 AndAlso intCol < 6 Then d. If intRow >= 0 AndAlso intRow < 2 AndAlso intCol >= 0 AndAlso intCol < 5 Thenarrow_forwardCan you write it in Java, add comments Create an application containing an array that stores eight integers. Prompt the user to enter the 8 integers. The application should call five methods that in turn (1) display all the integers, (2) display all the integers in reverse order, (3) display the sum of the integers, (4) display all values less than the calculated average value, and (5) display all values that are higher than the calculated average value. Save the file as ArrayMethodDemoarrow_forward
- In visual basic Create and initialize an array that will hold four popular cities in Texas.arrow_forwardA four-row, three-column array has seven elements. Group of answer choices True Falsearrow_forwardThere are 2 arrays, the first contains item numbers in inventory and the second parallel array contains the price of the items. The user will enter the item number they want to purchase, the program checks to see if it is a valid entry. If it is valid, it will tell the user the price of the item. If it is an invalid item, a message will display telling the user they entered an invalid item. Type up the code below, execute the program a few times.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education