Question
Write a Java program that asks the user for two integers, i1 and i2 (i2 > i1). It then calculates and prints the sum of
Write a Java program that asks the user for two integers, i1 and i2 (i2 > i1). It then calculates and prints the sum of all odd numbers between i1 and i2 (inclusive). It then prints sum of squares of all even numbers between 1 and 100. After that it prompts the user to enter floating point values (or double values) until a sentinel value of Q (meaning quit) is entered. It then prints the following:
The average of the entered values
The smallest and largest of entered values (you should not use == when comparing doubles and floats)
After that the user is prompted for his/her first name. It prints the name in reverse.
Important: Every number entered should be input validated. If your program crashes, you might get a 0.
A sample output is given below:
*********************LAB 4 Java Program Output Begin*******************************
Enter the first integer: 23
Enter the second integer: 45
The sum of all odd numbers between 23 and 45:
Sum of squares of all even numbers between 1 and 100: < Program should calculate this>
Please enter some numbers: 1.0 34.0 15.0 25.0 21.0 1.0
The average of the entered values is: 16.66
The smallest number is: 1.0
The largest number is: 34.0
Please enter your first name: KEVIN
Your name when reversed is: NIVEK
*********************LAB 4 Java Program Output Ends*******************************
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started