Question: Having a bit of trouble with this code. I think I have the gist of it but would like something to compare it to. Overall
Having a bit of trouble with this code. I think I have the gist of it but would like something to compare it to.
Overall Objective: For this lab, we will write a JAVA program to accept two real numbers from the user. If the first number is greater than or equal to the second, then we will display their sum. If the second number is greater than the first then we will display their difference. For this section, you will create a new project in your IDE called Lab2 and create a source file called Lab2.java inside that project. The following requirements must be met to successfully complete this section - Obj.1 [4 points] Declare and define two variables of datatype double. You can define them with names of your choice (make sure they are relevant). Obj.2 [4 points] Declare and define an object of the Scanner class to enable your source code to take user input. Obj.3 [4 points) Accept two real numbers from the user using the Scanner class object and store them in the variables you created earlier. Obj.4 [6 points] Use the selection statement if to decide whether the first user input number is greater than or equal to the second and display their sum. Otherwise display the difference of the two user inputs as your output. You can format the output as you see fit but ensure that it is understandable by the user. Obj.5 [2 points] Close the Scanner class object as discussed in the lectures. Once you are done editing your source code, make sure to save it (save often to prevent loss of data and work) and then compile your source code. The next step is to follow the submission guidelines in Section 2 of this document and turn your lab in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
