
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question

Transcribed Image Text:Follow these steps:
Open the Java file Errors.java.
Attempt to compile the program. You'll notice the compilation will fail due
to some errors. Fix all the compilation errors and compile the program
again. Every time you fix an error, add a comment to the line you fixed and
indicate which of the three types of errors it was.
Now run the program. Once again, you'll encounter some errors (this time,
runtime errors). Fix these errors and run the program once again to see if
it works.
Now run the program and notice the output. You'll notice that there are
some logical errors in the code. Fix these errors and run the program once
again to see if it now correctly displays what it should.
![public class Errors
{
public static void main (String[] args)
{
@ }
}
System.out.println("Welcome to my first program!\n")
String ageStr = "24 years";
int age = Integer.parseInt(ageStr);
11
System.out.println("I'm + age + " years old.");
int three = "3";
int answer Years = age + three;
System.out.println("Total number of years: + answerYears);
int answerMonths = answer Years * 12;
System.out.println("In 3 years and 6 months, I'll be + answerMonths +
11
//Once you've corrected all the errors, the answer should be 330.
months old");](https://content.bartleby.com/qna-images/question/1e8e9227-5638-4c55-8f12-27a4de3256b9/10177f5f-df0a-4873-8154-2c5787573541/hiu19f_thumbnail.png)
Transcribed Image Text:public class Errors
{
public static void main (String[] args)
{
@ }
}
System.out.println("Welcome to my first program!\n")
String ageStr = "24 years";
int age = Integer.parseInt(ageStr);
11
System.out.println("I'm + age + " years old.");
int three = "3";
int answer Years = age + three;
System.out.println("Total number of years: + answerYears);
int answerMonths = answer Years * 12;
System.out.println("In 3 years and 6 months, I'll be + answerMonths +
11
//Once you've corrected all the errors, the answer should be 330.
months old");
Expert Solution

arrow_forward
Step 1
Syntax errors are similar to grammar or spelling errors in a language. They occur when we don't follow the programming guidelines.
Logical errors don’t crash your code but do not give the result you expected.
Runtime errors occur when the program is running after the compilation has been successfully completed. When this error occurs, the program may hang or crash, displaying an error message.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- please do both Questions.arrow_forwardPlease type and execute this java program and also need an output for this java program as soon as possible.arrow_forwardWrite a Java application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent.Your application should roll the dice 12 times. Use a one-dimensional array to tally the number of times each possible sum appears. Display the results in tabular format. */arrow_forward
- Make a Java electronic voting program. There should be 4 total parties(people you can vote for) use object-oriented code and output your final result to a text file. Some things to consider: Well implemented variables, data structures, well-running codearrow_forwardJava Programmingarrow_forwardWrite the complete java program.arrow_forward
- Please answer this question in Java language with a screenshot of the output and .java filearrow_forwardWrite, Compile and Execute a Java program that prompts the user to enter a point (x, y) and checks whether the point is within the circle centered at (0, 0) with radius 10. For example, (4, 5) is inside the circle and (9, 9) is outside the circle, as shown in Figure below. (Hint: A point is in the circle if its distance to (o, 0) is less than or equal to 10. The formula for computing the distance is the square root of ((x2 - x1)² + (Y2 - Y1)²). Test your program to cover all cases.) у-аxis A У-аxis A (9, 9) (4, 5) (6, 4) .(2, 2) (0, 0) х-аxis (0,0) х-ахis Two sample runs are shown below. Enter a point with two coordinates: 2 2 -Enter Point (2.0, 2.0) is in the rectangle Enter a point with two coordinates: 6 4 -Enter Point (6.0, 4.0) is not in the rectanglearrow_forwardThis assignment will help you to get started with NetBeans and using Java compiler: To begin, put a block comment at the beginning of your Java file (and every Java source file in the future) with the assignment number, assignment title, program author [your name], and the date it's due. Next, similar to the programs presented in the first chapter of the textbook, use System.out object to display the following information: Your first name The name of the operating system you are using The name of your project (or simply the folder name if not using the IDE) The name of the class that contains the main() method in your source file. Note: Your program should print each of the above items on a separate output line. "The name of the class that contains the main() method in your source file.public class MyClass { public static void main(String[]) { System.out.println( "Hi" ); }}arrow_forward
- Don't use Math.pow(a, b)arrow_forwardDo not attempt, if you are using other's work. I'll give multiple dislikes for plagiarism and also will report your account. Give unique answer others are wrong. Question: Write a Java program that takes user input for two numbers, multiplies them, and prints the result. Ensure that your program is user-friendly, handling different data types, and providing meaningful output. Submission Guidelines: Use appropriate variable types for user input and the result. Implement input validation to handle unexpected user inputs. Print a clear and informative message along with the result.arrow_forwardCreate a Java electronic voting program. There should be 4 total parties(people you are able to vote for) use object oriented code and output your final result to a text file.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY