
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

Transcribed Image Text:Write a Java program that will ask the user for a starting number, ending number, and
a decrement number. The program will then count down, from the starting number
down to and including the ending number, by the decrement number, displaying each
number on a separate line. Also, for each displayed number, the program will say
whether the number is even or odd. This program will require the use of the "while"
loop as well as an "if/else" statement. Examine the sample outputs carefully in order to
structure your code in a logical manner.
This program will require the use of the "while" loop as well as the "if/else" statement.
Examine the sample outputs carefully in order to structure your code in a logical
manner. Remember... pseudo code is your friend. Work on 1 part at a time.
Notes:
Carefully read and adhere to coding standards – pay particular attention to the use of braces
and indentation
Choose meaningful identifiers for all variables and constants
Use blank lines here and there to separate logical steps in your code
Add comments to document your code. Comments are not optional and must be included.
Use a one-line comment before each block to describe what you are doing – don't
describe the code syntax, but rather the purpose of the code. These comments should
effectively describe the steps in your "algorithm."
• Spell things carefully, including capitalization, since Java is fussy about that
Check your results! Testing your code is IMPORTANT!
Here is a sample run of the program:
Here is another sample run:
What's the start number?
What's the start number?
100
What's the end number?
What's the end number?
What's the number you are decrementing by?
What's the number you are decrementing by?
22
The number 5 is odd.
The number 4 is even.
The number 100 is even.
The number 78 is even.
The number 3 is odd.
The number 56 is even.
The number 2 is even.
The number 34 is even.
The number 1 is odd.
The number 12 is even.
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 1 images

Knowledge Booster
Similar questions
- The program should be written in python 1. first ask the user to enter the number of students in the range of 1 to 10. 2. then the program asks the user to enter the number of tests (in the range of 1 to 5) 3. Then use a loop to collect the scores for those many tests for each student. The outer loop will iterate once for each student. The inner loop will iterate several times, once for each test. Each iteration of the inner loop will ask the user to enter the score for a test of a student. 3. After all iterations, the program should calculates and display the total scores and average score for each student.arrow_forwardIn Java, design a program that uses nested loops to display a multiplication table for numbers 1 through 12.arrow_forwardWrite a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate. You need to use a while loop to allow the user to enter numbers, one at a time, until some numeric sentinel value is entered. I recommend having a sentinel like 9999, something unlikely to be confused with an exam score. If the user enters a score < 0 or > 100 that is not the sentinel value then that score is to be rejected. Each time a legit score is entered, however, it should be added (appended) to a list. Once the user has entered all the numbers they want, calculate and display the average of the scores rounded to 1 decimal place. I attached my solution. I can not fix two…arrow_forward
- Write a complete program to generate a username based on a user's first and last name. Part One: Get a Valid First and Last Name ask the user for and read in their first and last name use a loop to validate the first name: it must be at least one character long and it must start with a letter use a loop to validate the last name: it must not contain any spaces Hint: use a nested loop. The outer loop will iterate until there is valid input. The inner loop will check each character in the String to see if any of them are whitespace. Part Two: Generate a Username generate a two-digit random number (i.e., a random number between 10 and 99, inclusive) create a username that is the following data concatenated: the first letter of their first name in lower case the first five characters of their last name in lower case; if the name is shorter than five characters, use the whole last name the two-digit number output the username to the user Additional Coding Requirements code…arrow_forwardPlease use python language. Write a recursive program to find the sum of first n numbers. sum = 1 +2 + 3 + …….narrow_forwardii) Describe the four IP abstraction levels in TCP. ii) Explain a fictitious scenario in which two computers share a video file via an open FTP connection with a weak TCP three-way handshake.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