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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!