Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
I need help creating a dice game program that prompts for a pattern of 6 dice and then counts the number of throw necessary to get that pattern to appear.
I want to use four methods (String, loop, if else, and other methods in the Java Language) in simplifying the code to better understand it. Guarantee inputs are in an acceptable range.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 4 images
Knowledge Booster
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
- In the chapter materials and the conference we saw and discussed the various Quotent programs that started with a fragile program design and made it more robust in implementation. It didn't finish the job, however. In this assignment, we take the same concept and make a robust Quotent program (to be named MyDivision.java). As before, we will ask for two integers and divide them to obtain the result; however, this time we will check for both division by zero and input type mismatch problems. Don't explicitly check the content of the input items, let Java's default handling manage the generation of the Exceptions (i.e., don't use the throw syntax, however you may use the throws syntax). Detect both of these conditlons and provide a mechanism for the user to make any necessary corrections before continuing the program to completion. Here is your starting code: /* Instructions:Don't test for zeros or non-numeric strings on your input.Let Java throw its built-in exceptions. Catch…arrow_forwardIs there a way to initilize the names for students and their respective addresses? I am trying to get the Java program below to display the rollcall number with an actual name and correlating address. It would also be helpful if the names were in ascending order like the roll call numbers are. For example the programs output would look like: [rollno=1, name=Allan, address=620 pioneer st] [rollno=2, name=Chris, address=801 cheney dr] [rollno=3, name=Fedrick, address=504 plymouth ave] etc... What would that look like? Please and thank you! Source Code: import java.util.ArrayList;import java.util.Comparator;import java.util.Random;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JTextArea; class Student { int rollno; String name; String address; public Student(int roll, String name, String add) { super(); this.rollno = roll; this.name = name; this.address = add; } @Override public String toString() {…arrow_forwardWriting a Modular Program in Java Summary In this lab, you add the input and output statements to a partially completed Java program. When completed, the user should be able to enter a year, a month, and a day to determine if the date is valid. Valid years are those that are greater than 0, valid months include the values 1 through 12, and valid days include the values 1 through 31. Instructions Notice that variables have been declared for you. Write the simulated housekeeping() method that contains input statements to retrieve a year, a month, and a day from the user. Add statements to the simulated housekeeping()method that convert the String representation of the year, month, and day to ints. Include the output statements in the simulated endOfJob()method. The format of the output is as follows:month/day/year is a valid date. or month/day/year is an invalid date. Execute the program entering the following date: month = 5, day = 32, year =2014Observe the output of this…arrow_forward
- This is a problem for you to figure out a correct regular expression using any Java compiler you are familiar or any java online interpreter to solve. YOUR NEED TO TYPE OUT YOUR REGULAR EXPRESSION (NOT HAND WRITTEN IN WORKSHEET) SO I CAN CUT AND PASTE YOUR REGULAR EXPRESSION TO VALIDATE YOUR ANSWER IN THE RUNNING JAVA PROGRAM WHEN I GRADE. Your answer should be replacing the string "^(\\d*)" in line 21 and submit this string. The "^(\\d*)" regular expression now is way too simple so it only able to validate the 1st test case out of 9 test cases. The line you will be changing is Pattern patt = Pattern.compile("^(\\d*)"); =============================================== import java.util.regex.Matcher;import java.util.regex.Pattern; public class RegularExp { public static void main(String[] args) { if (isANumber("12345")) System.out.println("true"); else System.out.println("false"); if (isANumber("-.23")) System.out.println("true"); else System.out.println("false"); if…arrow_forwardWrite a Java program that will use while loops. The while loop will show the cards currently in the hand and ask the user to accept a card (Hit) or to stop (Stand). Within the while loop the program should print the card that was just added, all the cards in the hand, and the new value of the hand. If the value of the hand exceeds 21, the game should end (the while loop should stop). Write out the algorithm for the while loop. Turn in a printout of the algorithm, the code and a printout of a sample run. Place the algorithm and the sample run inside comment blocks in the code. "The sample runs of such a program are on the attached image."arrow_forwardI have been working on writing a java program (that goes with another I just got finished- see below CollegeCourse & Student) that prompts user to put in letter grades (A-F) for 5 different courses for a total of 10 different students. So I need to prompt user to input a student ID, then the 1st course ID, then the grade, then the 2nd course ID- then grade, the the 3rd course ID then grade, then the 4th course ID then grade, then finally the 5th course ID then grade. Then it needs to go through the same thing 10 times (for a total of 10 students). It also says the user is asked to "Enter ID for student #s" where s is an integer from 1 through 10, indicating the student (and I don't really know how to do that but I tried as I googled java); AND "Enter course ID #n, where n is an integer from 1 through 5, indicating the course number. And last it needs to verify for grade entry that only the A, B, C, D, or F are entered.I started writing notes to try to keep track of where thing are…arrow_forward
- I need help coding this in java language.arrow_forwardIn Java Write a program that checks the properness of a given variable name. Morespecifically, your program should specify whether a user-entered variable nameis (1) illegal, (2) legal but uses poor style, or (3) good. There are differentopinions as to what constitutes a good style for a variable name. For thisprogram, check for good style using these rules:· Only use letters and digits.· Use a lowercase letter for the first character.You do not need to check for an uppercase letter for the first letter in the secondand third words, ...etc.Your program should repeatedly prompt the user for variable names until the userenters "q" or "Q." the program terminates when the user enters the "q" or "Q." Sample session:This program checks the properness of a proposed Java variable name.Enter a variable name (q or Q to quit): streetAddress2Good!Enter a variable name (q or Q to quit): street address2Illegal.Enter a variable name (q or Q to quit): StreetAddress2Legal, but uses poor style.Enter a…arrow_forwardWrite a code that generates a random lowercase letter. In java programming. Note: Not a string of letters just one letter is generated every time the program is run. meaning the output should not be something like this: a c t c -that's a random string, it should only be one random letter generated randomly.arrow_forward
- 2. Write a java program which will input an integer value from the user (Use Scanner class). Your program will have mathOper() method in addition to the main() method.The main() method will be responsible for:a. extracting the 1's digit (ones), the 10's digit (tens), and any digits larger than the 10's digit. For instance, if the input is 3562, the 1's digit would be 2, the 10's digit would be 6, and the remaining digits would be 35.b. call the mathOper() method with these 3 values,c. print the results to the screen.The mathOper() method will make the following calculations:a. Multiply the 1's digit by 7, subtract the result by 2 and then divide that by 5.b. Add 3.5 to the 10's digit, multiply the result by 4.3 and then divide that by 2.c. Subtract 5 from the remaining digits, multiply the result by 3, find the remainder after dividing that by 7, and then add 6 to the remainder value.d. Add the 3 values obtained from ‘a’, ‘b’, and ‘c’ operations.e. Return the final value.Sample output…arrow_forwardWrite a FULL Java procedural program for a simple word guessing game. Below is an example of the required program behaviour. The bold text is user keyboard input. The player is allowed to guess one letter or the whole word incorrectly up to 5 times; each incorrect guess is called a “strike”. The program starts by displaying one full stop (’.’) for each character of the secret word. You may assume the word is hardcoded into the game, is in lower case, and is of length greater than one. In each round of the game, the game first checks if the player has reached the maxinum number of strikes; if so, the player loses and the game ends. If not, the game prints an input prompt. The player then guesses either one letter (by entering a single character) or the whole word (by entering multiple characters). If a single letter is guessed correctly, meaning the character occurs in the word, the game reveals the positions of those occurrences in the word and proceeds to the next round. If the whole…arrow_forwardYour team was asked to program a self-driving car that reaches its destination with minimum travel time. Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car's current speed and the distance to the target destination. Assume that both distances and car speed are given. The programming language I'm using is Java. So, it'll be appreciated if the solution was in Java Thanksarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education