Program contains several errors

Assignment Help JAVA Programming
Reference no: EM131840124

The following program contains several errors that violate the rules of Java: 

1. public class writeSequence{ 

2. public static void main(String[ args){ 

3. writeSequence(5.3); 

4. } 

5. pulbic static void writeSequence(int x){ 

6. if(x==1){ 

7. System.out.print("1"); 

8. } 

9. else if(x=2){ 

10. System.out.print("1 1"); 

11. } 

12. else if(x%2==0){ 

13. System.out.print((x/2) + " ); 

14. writeSequence(x-2); 

15. System.out.print(" " + (x/2)); 

16. } 

17. else if(x%2 == 1 ){ 

18. System.out.print(((x+1)/2) + " "); 

19. writeSequence((x-2)); 

20. System.out.print(" " + ((x+1)/2)); 

21. } 

22. } 

23. } 

Locate all the errors and specify whether each one is (a) lexical, (b) syntactic, or (c) semantic. Use the numbers shown to identify the line on which each error occurs. The program may also contain programming errors that do not violate the rules of Java and will not be detected by a Java compiler. You should ignore these errors.

Reference no: EM131840124

Questions Cloud

Secret to ciscos success was : Place yourself in the Management position in charge of Reverse Logistics. The Secret to Ciscos success was
Identify the facts relied upon to make the selection : Identify the facts relied upon to make the selection. Use the course material to support your reasoning and conclusions.
What is the drug enforcement administration schedule : Would you be more concerned about executing a warrant in a clandestine methamphetamine laboratory or an industrial chemical laboratory? Why?
Determine the fair value of the debentures : On 1 July 2015 Kruger Ltd privately issues $1 million in six-year debentures, which pay interest each six months at a coupon rate of 6 per cent per annum.
Program contains several errors : e following program contains several errors that violate the rules of Java:
Compute the accounts receivable balance : Compute the accounts receivable balance before and after the change in the cash discount policy. Should the new cash discount policy be utilized
Examine future management issues and trends : Create a client profile and discuss practices and resources in case management that should help that client succeed after release.
What is potential gross income and effective gross income : What is the potential gross income? What is the effective gross income? What is the net income?
Discuss transportation and logistics management : This week you will discuss transportation and logistics management and its impact on various economic activities

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd