Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following Code should read the first and the second number of the student ID then print the sum and divide it by zero if

The following Code should read the first and the second number of the student ID then print the sum and divide it by zero if possible. However, there are three errors in the code. Find each error and specify its type (syntax, runtime, or logic) and correct them in the bellow table. Then, write the code after you correct all errors and provide screenshot of the output.
Note:
1.The correct code should be tested using your first two numbers of your student ID. 
2.Your answer should have the code as text as well as the screenshot of the program output (using your own student ID) as a part of your answer. Otherwise, zero marks will be awarded.
import java.util.Scanner; 
public class Main {
 public static void main(String[] Strings) {
   Scanner input = new Scanner(System.in); 
   System.out.println("Enter the first number of your student ID: ");
   int number1 =input.nextInt();
   
   Systm.out.println("Enter the second number of your student ID: "); 
   int number2 =input.nextInt();
   
   System.out.println("The sum of two two numbers is " + number1+number2); 
   System.out.println("The sum devided by Zero is: " + (number1+number2)/0); 
   
   } 
}


 

Error Type Correction

Step by Step Solution

3.45 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

Steps Step 1 of 3 Sure I can explain the steps to correct the errors in the given code Here are the ... 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

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students also viewed these Programming questions

Question

3. Formal System is better than Self Assessment System. Discuss

Answered: 1 week ago