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
Concept explainers
Question
Guess-the-number-game: Write a
the number” as follows: Your program choose the number to be guess by
selecting an integer at random in the range 1 to 1000. The program then
displays the following:
I have a number between 1 and 1000.
Can you guess my number?
Please type your first guess.
The player then type a first guess. The program responds with one of the
following:
1. Excellent ! you guessed the number!
Would like to play again (y or n)?
2. Too low. Try again.
3. Too high. Try again.
If the payer’s guess is incorrect, your program should loop until the player
finally get the number right. Your program should keep telling the player
Too high or Too low to help the player “zero in” on the correct answer.
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 3 steps with 1 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
- Value returning method Write a program to calculate items sale pricearrow_forwardWrite a guessing game program: - The program has to first generate a random number in range 1 - 100 inclusive.- The user has to enter a guess- The program has to either print lower or higher (if the user guess is less than the answer, it should print higher, otherwise lower)- The program should end and print 'You got it!' when the user gets it right. example: generated random number: 78 ````50```` example: generated random number: 78 ````50```` ````higher```` ````75```` ````higher```` ````87```` ````lower```` ````81```` ````lower```` ````78```` ````You got it!````arrow_forwardThe following table shows the approximate speed of sound in air, water, and steel: Write a program that asks the user to enter “air”, “water”, or “steel” and the distance that a sound wave will travel in the medium. The program should then display the amount of time it will take. You can calculate the amount of time it takes sound to travel in air with the following formula: Time = Distance / 1,100 You can calculate the amount of time it takes sound to travel in water with the following formula: Time = Distance / 4,900 You can calculate the amount of time it takes sound to travel in steel with the following formula: Time = Distance / 16,400arrow_forward
- السبت ۲ أكتوبر المحاولة رقم 1 :2 HW • Write a program that computes the average of 5 students grades which are entered by the user. Write a program that converts pounds into kilograms. The program prompts the user to enter a number in pounds, converts it to kilograms, and displays the result. One pound is 0.454 kilograms. محتوى إضافي؟ يمكنك إضافة نص وملفات تدعم إجاباتك. إضافة محتوی إرسال الحفظ لوقت لاحقarrow_forwardJAVA PROGRAM A company selling household appliances gives commissions to its salesman determined by the kind of product sold as well as the sales amount.Type 1: 7% of sale or 400, whichever is more.Type 2: 10% of sale or 900, whichever is less.Type 3: 12% of sale.Type 4: P250, regardless of sale price.Make a program that would input the TYPE of appliance sold (between 1-4) and the sale PRICE(a positive floating-point value), and output the COMMission that the salesman will receive.arrow_forwardThe date June 10, 1960, is special because when we write it in the following format, the month times the day equals the year: 6/10/60 Write a program that ask the user to enter a month in numeric format, a day and a two-digit year. The program should then determine whether the month times the day is equal to the year. If so, it should display a message saying the date is Magic. Otherwise, it should display a message saying the date is not Magic. Output should look as shown below. Create test data and place in a file. Name the code file Last Name + First Initial + "-MagicDates.s", for example "SmithJ- MagicDates.s". Name the test data file in a similar manner. Upload the program and test data files to the Dropbox. 6/10/60 is Magic! 6/10/70 is not Magic. 2/11/22 is Magic!arrow_forward
- Part 4 Guessing game (random and absolute) Write a program that does this: You (as programmer) are the dealer. Pick a random number for yourself (between 0 and 100). Ask the user to input a random number (between 0 and 100). Whoever is closer to 21 wins the game. If the dealer wins, say "Dealer wins." If the user wins, say “Player wins”. Example output: Player please pick a number. 45 Dealer has 25 Dealer wins. Part 5 Guessing game loop (keeping a counter) Write the same program as in part 4, but keep it going so that it keeps playing (dealing hands and saying who wins) until the User enters the number 21 at which point you print out some stats and say goodbye, for example, your goodbye might look like this: Number of hands played: 5 Dealer won: 3 Player won: 2 You're 2 for 5 Come back to thearrow_forwardpython Write a program that prompts the user to enter the number of study hours of a student and the average of the student. Then the program is checking the following:- If the average of the student is greater than 4 and the number of hours is less than 26, then the program should display "You have a chance".- Otherwise, the program should display "You do not have a chance".arrow_forwardcorrect all errors.arrow_forward
- Program Unit Score Calculator Console App Write a Python Console Application program that allows the user to enter the marks for different assessments in a unit, and computes the total mark and grade for the unit. Here is the program logic specification: There are six assessment activities Quiz1, Quiz2, Quiz3, Quiz4, Lab Journal, Major Assignment and Final Exam. The four quizzes are worth 5 marks each, the Lab Journal is worth 10 marks, the Major Assignment is worth 30 marks and the Final Exam is worth 40 marks. The algorithm for computing the total mark for the unit is: Total Mark = Quiz1+Quiz2+Quiz3+Quiz4+Major Assignment+ Lab Journal + Final Exam The following screenshot shows a successful test run:arrow_forwardQuestion 3 - - / 0 Write a program that allows to modify an integer x between 50 and 100 to x+1 if its first decimal is 9 or 4. For example x=64 becomes 65 and x= 79 becomes 80. x is read from keyboard as a mark of a student and must be between 0 and 100. Type your answerarrow_forward
arrow_back_ios
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