Write a program that asks the user for the starting value of their number sequence, and the ending number of their sequence. Then ask the user if they want even or odd numbers or both! First output all the numbers of the sequence in one line (okay if computer output wraps the output line visually). Then output all the numbers in that sequence that match what the user wants, per the examples.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

I need help to create a program and here are the requirements.

 

Program2:
Write a program that asks the user for the starting value of their number sequence, and the ending
number of their sequence. Then ask the user if they want even or odd numbers or both! First output
all the numbers of the sequence in one line (okay if computer output wraps the output line visually).
Then output all the numbers in that sequence that match what the user wants, per the examples.
Your program logic must be written with the most efficient and optimal logic possible (least amount
of code possible), so if you are cutting and pasting the same code and using it without changing it
then you need to see how to best rearrange your logic. You should only be using at most two FOR
loops in the entire program, and no WHILE loops.
Examples only, your program must work for any user inputs choices, but your prompts and output
statements, and format of the data must match the examples below. Highlighted items are user inputs
for the examples.
Example 1:
Enter starting value : 5
Enter ending value : 10
Do you want even, odd, or both numbers? (even/odd/both) : even
Here are your numbers: 5,6,7,8,9,10
Here are your even numbers:
6
8
10
Еxample 2:
Enter starting value : 5
Enter ending value : 10
Do you want even, odd, or both numbers? (even/odd/both) : odd
Here are your numbers: 5,6,7,8,9,10
Here are your odd numbers:
7
9
Example 3:
Enter starting value : 5
Enter ending value : 10
Do you want even, odd, or both numbers? (even/odd/both) : both
Here are your numbers: 5,6,7,8,9,10
Here are your numbers:
6
7
8
9
10
hint on how to determine even and odd numbers:
https://beginnersbook.com/2014/02/java-program-to-check-even-or-odd-number/
Transcribed Image Text:Program2: Write a program that asks the user for the starting value of their number sequence, and the ending number of their sequence. Then ask the user if they want even or odd numbers or both! First output all the numbers of the sequence in one line (okay if computer output wraps the output line visually). Then output all the numbers in that sequence that match what the user wants, per the examples. Your program logic must be written with the most efficient and optimal logic possible (least amount of code possible), so if you are cutting and pasting the same code and using it without changing it then you need to see how to best rearrange your logic. You should only be using at most two FOR loops in the entire program, and no WHILE loops. Examples only, your program must work for any user inputs choices, but your prompts and output statements, and format of the data must match the examples below. Highlighted items are user inputs for the examples. Example 1: Enter starting value : 5 Enter ending value : 10 Do you want even, odd, or both numbers? (even/odd/both) : even Here are your numbers: 5,6,7,8,9,10 Here are your even numbers: 6 8 10 Еxample 2: Enter starting value : 5 Enter ending value : 10 Do you want even, odd, or both numbers? (even/odd/both) : odd Here are your numbers: 5,6,7,8,9,10 Here are your odd numbers: 7 9 Example 3: Enter starting value : 5 Enter ending value : 10 Do you want even, odd, or both numbers? (even/odd/both) : both Here are your numbers: 5,6,7,8,9,10 Here are your numbers: 6 7 8 9 10 hint on how to determine even and odd numbers: https://beginnersbook.com/2014/02/java-program-to-check-even-or-odd-number/
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Module hierarchy chart
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
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education