Question: import java.util.Scanner; public class EXAM4 { public static void main(String[] args) { // Use a Common Scanner for all Section A,B,C,D Scanner in = new

import java.util.Scanner; public class EXAM4 { public static void main(String[] args) { // Use a Common Scanner for all Section A,B,C,D Scanner in = new Scanner(System.in); /**------------------ Part A - Input integers and print the smallest and largest integer entered Terminate input and print results when operator enters any letter */ //Identify your variables int largest=-10000; int smallest=10000; //Ask for Input System.out.print("Enter a number from -9999 to 9999 , enter any letter to print results: "); //Loop - While Loop terminates when no integer entered while (in.hasNextInt()) { int input = in.nextInt(); if (input > largest) { largest = input; } if (input < smallest) { smallest = input; } } // Print the results System.out.println("Largest: " + largest + " " + "Smallest: " + smallest); /**------------------------ Part B - Input integers (ranging from -9999 to 9999) and print the number of even and odd inputs Terminate input and print results when operator enters anything other than an integer */ //Identify your variables //Ask for Input Once //Loop - While loop terminates when no integer entered // Print the results /**--------------------------- Part C - Input integers and print running totals For example if 1,7,2,9 are entered, you print 1,8,10,19 (Hint: Print will be inside while loop) Terminate input and print results when operator enters anything other than an integer */ //Identify your variables //Ask for Input Once //Loop - While loop terminates when no integer entered // Print the results /**---------------------------- Part D - Input 10 integers all adjacent duplicates. Use a FOR loop- No error checking for this one - Just assume all inputs are integers For example if 1,3,3,4,5,5,6,6,6,2 are entered, you print 3,5,6 (Hints: Compare previous input to next input, Print will be inside FOR loop) */ //Identify your variables //Ask for Input Once //Loop - FOR Loop - terminates after 10 integers are entered // Print the results in.close(); } }. Copy paste the code from the the attached start file into EXAM4 class, follow the instructions to complete PARTS B,C,D using the same structure as done in PART A.

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!