Lab Exercise 3 COMP 248 Due date: Today, at the end of the lab period. Read this entire document before beginning your l
Posted: Fri May 20, 2022 6:05 pm
Lab Exercise 3 COMP 248 Due date: Today, at the end of the lab period. Read this entire document before beginning your lab. The Comp248LabManual is available on the Lab page of the course website if you don't remember how to use the PC? lab system, you should worry about this after completing the question. For this lab you are required to fulfill all requirements exactly as described in this provided document, no less, no more. Question: Today you are commissioned to write a Java program that will prompt for and read 4 integer values (named n1, n2, n3 and n4 in this document) entered by the user and determine if the input consists of 2 matching pairs in any order. Be sure to use the same format and wording as in the sample runs in the table below. Using nested ifs determine if there are 2 matching pairs or not. If there are display the pair. If there aren't 2 matching pairs output a message saying so and if the 4 numbers are the same display a message for that as well. There will only be one message printed. In other words if they are all the same, do not test for matching pairs. Here are the possible ways that you can have 2 matching pairs: . n1 = n2 and n3 = n4 n1 = n3 and n2 = n4 n1 = n4 and n2 = n3 The box below illustrates how your program should behave and appear. REMEMBER in the output: • is a space and is a new line. Text in green is user input Enter -4° numbers: 1020303 Fails Enter 4 numbers: 5050505 All of the numbers are the same, namely 5 Enter 4 numbers: 1° 1.2020 There are 2 pairs of 1 and 2 Enter 40 numbers: 1° 2° 1022 There are 2 pairs of 1 and 2 Enter 4 numbers: 302 203 There are 2 pairs of 3° and 2