Concept explainers
a.
Syntax error:
An error which occurs on the source code of a
Compilation error:
It is an error which occurs when a compiler fails to compile the program due to some errors. This type of error helps the coder to debug the program code for some possible errors.
Logical error:
Logical error prevents the program from performing, because of the errors in the logical statements.
b.
Explanation of Solution
Error in given program:
Error 1: In Line 3, the semicolon (;) at the end of for loop must be removed.
Corrected statement:
for(int i=0;i<10; i++)
Modified code:
//class definition
public class ShowErrors
{
//Main method
public static void main(String[] args)
{
//variable declaratio...
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
- Implement programs involving the use of while, do..while and for loop statement.arrow_forward[Python Language] Using loops of any kind, lists, or is not allowed. Angela loves reading books. She recently started reading an AI generated series called “Harry Trotter”. Angela is collecting books from the series at her nearest bookstore. Since the series is AI generated, the publishers have produced an infinite collection of the books where each book is identified by a unique integer. The bookstore has exactly one copy of each book. Angela wants to buy the books in the range [l,r], where l ≤ r. As an example, the range [−3,3] means that Angela wants to buy the books − 3, − 2, − 1, 0, 1, 2, and 3. Dan also loves the series (or maybe annoying Angela – who knows, really), and he manages to sneak into the bookstore very early to buy all of the books in the range [d,u], where d ≤ u. When Angela later visits, sadly she will not find those books there anymore. For example, if Angela tries to buy books [−2,3] and Dan has bought books [0,2], Angela would only receive books − 2, − 1,…arrow_forwardWhat is the time complexity of the following code?arrow_forward
- ASAP Please give me ALL the C++ codes for this task. Attach ALL the outputs. I am requesting to not copy from any other sources.Explain all the steps. thank you for you help! 1) Implementing Othelloimplement a variant of the game Othello according to the UML Class diagramsprovided below and the original rules specified in this link:https://www.worldothello.org/about/about-othello/othello-rules/official-rules/englishYou will be evaluated primarily on how playable your game is. You will also be evaluated on havingfollowed the provided design. Lastly, and to a lesser extent, you will be evaluated on updates to thedesign diagrams that you make and the justification of any changes from the original design (preferablyincluded as UML notes.In this variant of Othello, some positions on the board will be unplayable. The starting position mayvary, and the rules for flipping pieces may be adjusted. The class diagrams provided will show you theminimal object oriented approach that you should…arrow_forwardImplement the function of modulus operator. Don't use the inbuilt function. Programming language: Javaarrow_forward(YOU ARE NOT ALLOWED TO USE ARRAYLIST IN THIS PROJECT)Write a Java program to simulate a blackjack game of cards. The computer will play the role of the dealer. The program will randomly generate the cards dealt to the player and dealer during the game. Cards in this game will be represented by numbers 1 to 13 with Ace being represented by a 1. Remember, that face cards (i.e. Jack, Queen, and King) are worth 10 points to a hand while an Ace can be worth 1 or 11 points depending on the user’s choice. The numbered cards are worth their number value to the hand.arrow_forward
- Can You Simulate of the division with the basic operations {σ, π, U, P, -, *}?arrow_forwardAnswer in C++ only Sanjiv Kapoor is a very well-known Chef in India and even in the world. He is planning to plant a flower garden - a n-line grid and columns m. In each cell of this grid, one flower is planted; let's say the type of flower planted in a cell (i, ) by ai, j. Today, Sanjiv Kapoor will make a new menu with two dishes: Italian and Chinese. You need to choose as many flowers as possible to decorate the dishes and make them look attractive. Each bowl can only be decorated with flowers of one kind, so he can choose only one or two flowers. Also, Chef Go wants the flowers he chooses to form one connected place, so he can finish his job as soon as possible. Connected area is a group of cells that we can move from any cell to any other cell in this set by simply moving between adjacent cells from the set. Help Sanjiv Kapoor to find the largest connected area in his flower garden that contains at least two types of flowers. Example Input 45 11 2 3 1 3 1 25 2 5 2 1 5 6 1 3 1 2 1…arrow_forwardNeed Python Solution Ramesh, Suresh, Mahesh, and Mukesh moved to a new town and searched for accommodations. Now this city is unlike any other city. This city is an apartment matrix and there are no roads. The only way to get around is through houses. If one of the friends passes the apartment once, the party will have to pay its full rent. From the apartment, you can go to the houses to the North, South, East, or West. Since Ramesh, Suresh, Mahesh, and Mukesh are best friends, they want to meet at least once a month. Also, all four are superstitious, so Ramesh goes West only, Suresh goes North only, Mahesh goes East only, and Mukesh goes South only. Any number of people can live in any apartment. The cost of all housing in the city is provided, some of which may be negligible. Negative costs mean that if a friend lives in or moves out of the apartment, the party will be paid an amount equal to the cost dispute. Now the goal of these four friends is to earn enough money to live in the…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning