Several errors that violate the rules of java

Assignment Help Basic Computer Science
Reference no: EM131843179

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: EM131843179

Questions Cloud

What is the value of an orion bond : What is the value of an Orion bond that has a 10 percent coupon, pays interest semiannually, and has 10 years to maturity, if required rate of return is 15 %
Medical weight conversion calculator : Need Code Solution for Week 4 Lab 2: Medical Weight Conversion Calculator which is on Page 346 of Textbook.
What is the purpose of your message : You are the head of the catalog sales department of Branford's, a large department store located in Albuquer-que, New Mexico.
Which author seems most representative of modern viewpoint : Which author seems most representative of the Modern viewpoint as you understand it? How those qualities appear in the poetry of ee cummings, for example.
Several errors that violate the rules of java : The following program contains several errors that violate the rules of Java:
What is the current yield on pk bonds : The bonds make semiannual payments and currently sell for 108.25 percent of par. What is the current yield on PK's bonds?
Which distributor was unable to meet its demand : What is the total cost to minimize shipping costs from the plants to the distributors?Which distributor was unable to meet its demand?
Compute the average product cost : Burger Doodle is a fast-food restaurant that processes an average of 680 food orders each day. The average cost of each order is $6.15.
Write a console application that prompts : Can you help me write a console application that prompts the user to enter 5 test scores of double data type, then calculates and displays the sum

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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