Question: Java Programming 1 Lab 6 : Lab Problems For all problems, use inline comments to describe major actions. Ask for assistance if needed. 1 .

Java Programming 1 Lab 6:
Lab Problems
For all problems, use inline comments to describe major actions. Ask for assistance if needed.
1. do-while and Sentinel-Controlled Loops Write a Java program named LabO6Prob01.java using a do-while loop. During execution of the loop, ask the user for floating-point values from -100.0-100.0 and determine the largest and smallest of those numbers. Any numbers outside of the range should be ignored. The loop should exit once the user enters a value of -19.5.1. After the loop exits, provide descriptive text to indicate both the smallest and largest values entered up to one decimal place. The sentinel value should not be included in any calculations and you should account for the situation where NO valid values are entered
and not print a max/min.
For example, for the values 100.7,50.2,-201.1,701.7,11.3,-15.7,14.4,37.4,-19.5 the max
value is 50.2 and the min value is -15.7.
Expected Output (valid values):
The max value was 50.2
The min value was -15.7
Expected Output (no valid values):
There were no valid values
Note that the grader will provide its own input for this program and your program should correctly calculate the values for the given input, not just your tested values.
2. Recall that for loops can be used to calculate approximations that are represented using running sums from one number to another number. For instance, a running sum of values from 0-50(inclusive on both ends) can be represented in Java code as:
int sum =0;
for (int i =0; i <=50; i++){
sum += i; // calculate each term
}
Write a Java program named Lab06Prob02.java that calculates the series represented by:
250
DY (2i+1)
i=5
The program should calculate the series value based on the given summation using a for
loop and display the final result with descriptive text, and auto-placed commas.
HINT: This should result in a sum of 21,084,086.
Expected Output:
The sum is 21,084,086
while Loops (Sentinel-Controlled) Write a Java program named LabO6Prob03.java that contains a while loop that can be controlled using a sentinel value. Write your loop so that only positive, even integer values are summed up and the resulting average of those numbers is output to the console once the sentinel value of 672 is entered.
After the loop exits, provide output that includes descriptive text, the calculated sum, and the calculated average which should be limited to four decimal places. The sentinel value should not be included in any calculations. For instance, input of 4,2,-5,-7,8,3,7,672 should provide a sum of (4+2+8)=14 and an average of 14/3 ~=4.6667.
Expected Output:
For the positive, even numbers, the sum was XX and the average was X.XXXX
Note that the grader will provide its own input for this program and your program should correctly calculate the values for the given input, not just your tested values.

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 Programming Questions!