Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is LoopSum.java starting code: /* Programmer: Date: Project: Lab 2.6 LoopSum File Name: LoopSum.java Program Description: Uses a do while loop to trap the

image text in transcribed
Here is LoopSum.java starting code:
/* Programmer:
Date:
Project: Lab 2.6 LoopSum
File Name: LoopSum.java
Program Description: Uses a do while loop to trap the input between 1 and 99 (inclusive) and a while loop to sum all odd integers between 1 and the input number.
*/
import java.util.*;
public class LoopSum{
public static void main(String[] args){
// Variable to accept the user's input
Scanner keyboard = new Scanner(System.in);
// Enter your code here
}
}
Finish the program LoopSum.java to satisfy the following conditions. 1. Use a do while loop to have the user enter a positive integer under 100. The program should continue asking for input if the user enters an integer that is not positive or not under 100 2. Use a second do while loop to have the user enter an integer that is both even and greater than the value entered in part 1. The program should continue asking for input if the user enter an integer that is odd or is not greater than the integer entered in part 1. 3. Use a do while or a while loop to sum all integers starting from the integer entered in part 1 up to and including the integer entered in part 2. Enter a positive integer under 100: 6 Enter an even number greater than 6: 10 The sum of all integers between 6 and 10 is: 40 Enter a positive integer under 100: 0 Enter a positive integer under 100: 3 Enter an even number greater than 4: 2 Enter an even number greater than 4: 5 Enter an even number greater than 4: 8 The sum of odd integers between 3 and 8 is: 33

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

What is job enlargement ?

Answered: 1 week ago