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
thumb_up100%
Write a java
This program prints the Fibonacci sequence
Enter a limit on the largest number to be displayed: 50
1 1 2 3 5 8 13 21 34
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 2 steps with 2 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
- I need help with creating a Java program based with the loop methods:arrow_forwardA patient suffering from asthma needs to keep a diary of their "peak flow" breathing readings. This is just a number between 0 and 800 measuring how well they can blow air from their lungs. Their peak flow reading is the greatest of three readings taken at one time. Write a Java program to help the patient record their peak flow to show their doctor. The program should first ask the patient for the number their doctor has given them as being a dangerous reading. Any peak flow reading recorded that is less than the danger level should lead to a message that they need to go to hospital immediately. Once entered, this value should not be changed. After storing this number, the program should go into a loop that only stops when they type 0 instead of a day. It should repeatedly ask them for the day of the month which is a number from 1 to 31 (they may skip days) and then the three readings taken that day. All the peak flow readings (ie the largest of each set of three readings) should be…arrow_forwardJava Programming: Write a program that reads five integer values from the user, then analyzes them as if they were a hand of cards. When your program runs it might look like this (user input is in orange for clarity): Enter five numeric cards, no face cards. Use 2 - 9. Card 1: 8 Card 2: 7 Card 3: 8 Card 4: 2 Card 5: 9 Pair! (This is a pair, since there are two eights). You are only required to find the hands Pair and Straight.arrow_forward
- PrimeAA.java Write a program that will tell a user if their number is prime or not. Your code will need to run in a loop (possibly many loops) so that the user can continue to check numbers. A prime is a number that is only divisible by itself and the number 1. This means your code should loop through each value between 1 and the number entered to see if it’s a divisor. If you only check for a small handful of numbers (such as 2, 3, and 5), you will lose most of the credit for this project. Include a try/catch to catch input mismatches and include a custom exception to catch negative values. If the user enters 0, the program should end. Not only will you tell the user if their number is prime or not, you must also print the divisors to the screen (if they exist) on the same line as shown below AND give a count of how many divisors there are. See examples below. Your program should run the test case exactly as it appears below, and should work on any other case in general. Output…arrow_forwardIn java, create a program that will use a do while loop with a "yes/no" prompt. The program should include user input and output with getters and setters. Once the end of the loop is reached, ask the user if they'd like to do the program again. Answering "Yes" will start the program over again. Answering "No" will end the program. Answering with anything else will be an invalid input. Once the loop begins again, the program should also discard all previous inputs so that there won't be any overlapping. Use Scanner.nextLine();, it will help.arrow_forwardIn Java Write a program to score the paper-rock-scissor game. Each of two users types ineither P, R, or S. The program then announces the winner as well as the basis fordetermining the winner: Paper covers rock, Rock breaks scissors, Scissors cut paper,or Nobody wins. Be sure to allow the users to use lowercase as well as uppercaseletters. Your program should include a loop that lets the user play again until theuser says she or he is done. The program should perform input validation for theplayer’s input (only ‘R’, ‘P’ or ‘S’ are acceptable).Sample Run:Player 1: Please enter either R)ock, P)aper, or S)cissors.RPlayer 2: Please enter either R)ock, P)aper, or S)cissors.SPlayer 1 wins.Totals to this move:Player 1: 1Player 2: 0Play Again? Y/y continues, other quits. YPlayer 1: Please enter either R)ock, P)aper, or S)cissors.SPlayer 2: Please enter either R)ock, P)aper, or S)cissors.PPlayer 1 wins.Totals to this move:Player 1: 2Player 2: 0Play Again? Y/y continues, other quits.…arrow_forward
- You have been hired by a local organic sod company to write coverage calculator for their website. Organic sod is cut into rectangles 9 square foot in area for lawn installation. Your program will prompt the customer for the length and the width of a rectangular area being covered with sod. Implement the following "pseudocode" to obtain the number of pieces to order. • Compute the area of the rectangle to be covered • Divide the area by 9 • Convert the result to an integer and then add 1 Below is a sample run with Python output in blue and user input in black. Enter length:200 Enter width:40 You should order 889 pieces.arrow_forwardCan you please make this in Java?arrow_forwardWrite a program to compute the sum of the first N Fibonacci numbers, where N is an integer that is input by the user. Once it computes the sum, the program will prompt the user for a new value of N. The program will exit if the user enters a non-integer number or string (such as “quit”) instead of an integer. Language: Java The first four numbers of the Fibonacci sequence are: 0, 1, 1, and 2. Use For loop at least once, can use while loops. Sample Output: Welcome to the Fibonacci AdderTo quit, enter a non-integer number or string How many Fibonacci numbers should be summed? >> 10The sum of the first 10 Fibonacci numbers is: 88 How many Fibonacci numbers should be summed? >> xxx Thank You for Using the Fibonacci Adderarrow_forward
- Write a program that asks the user to enter 10 numbers, that range from 10-100. Make sure that you do not accept any numbers less than 10, if a user enters a number that is less than 10 then ask him again. Once the user enters all 10 numbers, sort the numbers entered in ascending order and print them out. CSharparrow_forwardJAVA Write a program that plays a number-guessing game to guess a secret number randomly generated within the range 1 and 10. The user will get as many numbers of tries as he/she needs to guess the number. Tell the users if their guess is right or wrong and if their guess is wrong let them try to guess the number again. You have solved a similar problem in a previous lab using a while loop. You must generate the secret number using the Java Random class. When the user guesses a number he/she will have to take an input of his guessed number from the keyboard. The user will have to take as many inputs as needed to guess the correct secret-number. That means the code will keep looping as long as the guess is different from the secret number. You also need to count the number of tries and report the count at the end. Use a do-while loop to prompt the user to guess again if the guess is wrong. Make sure that it doesn't mess up the output if you guess the secret number on the first try.…arrow_forwardIn Java: Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: yes Ex: If the input is: 42,000 or 1995! the output is: no Hint: Use a loop and the Character.isDigit() function.arrow_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