Run the code

Assignment Help JAVA Programming
Reference no: EM13768708

Question 1

1. Run the following code:

Int I =2147389549;
Boolean flag = true;
While(flag){
System.out.println(i);
i=i+1;
}

2. Explain the loop;

3. Explain the output aYer you let it run 20 seconds, 5 minutes, 10 minutes.

Question 2

1. Run the following code:

Int I =2147389549;
Boolean flag = true;
While(flag){
System.out.println(i);
If(i==0) i=i+1;
Else if (i<0) flag = false;
Else i++;}

2. Explain the output;

3. What happens if you initialize the value with 2147389548?

4. Fix the loop to stop when i overflows.

5. Run it the modification

Question 3

1. Run the following code:

String ruler1 = "1";
String ruler2 = ruler1 + "2" + ruler1;
String ruler3 = ruler2 + "3" + ruler2;
String ruler4 = ruler3 + "4" + ruler3;
String ruler5 = ruler4 + "5" + ruler4;

System.out.println(ruler1);
System.out.println(ruler2);
System.out.println(ruler3);
System.out.println(ruler4);
System.out.println(ruler5);

2. Set a while loop to do produce the same output.

3. Run it

Reference no: EM13768708

Questions Cloud

Evaluating the pros and cons of multinationalization : Evaluating the pros and cons of multinationalization; and the even more general issue of risk vs, return as manifested in "diversification" on economic activities. Discuss both of these aspects.
Presidential doctrine concept : Describe the effect that the presidential doctrine has had on regional or global affairs since it was announced during the Cold War.
Sports and globalization efforts of professional sports leag : Complete a thorough review on the topics of the business of sports and globalization efforts of professional sports leagues. Organize your two-to-three page paper according to appropriate APA style including a title page and reference page.
Write about ethics as a component of organizational culture : Write a paper about Write a paper on Ethics as a Component of Organizational Culture. Your paper should include an introduction and conclusion that summarize the contents of the entire paper.
Run the code : Run the following code, Explain the output aYer you let it run 20 seconds, 5 minutes, 10 minutes.
Profits and revenues and to gain access : Discuss why firms are attracted to foreign markets, for example, to increase profits and revenues and to gain access to cheaper manufacturing. How may this affect the domestic country of the firm?
International workforce and its impact on strategy : The workforce management is far more complicated in companies with operations in multiple countries than their domestic counterparts. There are political, economic, social-cultural, technological, and legal issues that add substantial challenges t..
Doppler radar, polarized sunglasses, rainbow issues : Explain how doppler radar works. Describe the properties of electromagnetic and interactions that make Doppler radar possible.
Kinds of international strategies : When companies expand into the international arena, they do so either because their home market has matured or because they see real opportunities in the foreign market. Discuss which kinds of international strategies are most appropriate for comp..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a program called inheritancetest java

Write a program called InheritanceTest.java to support an inheritance hierarchy for class Point-Square-Cube. Use Point as the superclass of the hierarchy. Specify the instance variables and methods for each class.

  Considered to be an improved version

Part (c) is considered to be an improved version of Part (b). You may use an array (2-dimessional) to store some values that has been computed during the run so that when making recursive calls the program does not compute certain values over and ..

  Balancing binary search trees

Balancing Binary Search Trees,  Consider the file BST.java (a link to this file is provided below for downloading purposes) which defines a generic Binary Search Tree class.

  Illustrate how to create a bufferedinputstream

What are Buffered Input / Output Streams and why are they used - write some Java code to illustrate how to create a BufferedInputStream.

  Write a bag class with a generic type

Write a Bag class with a generic type. Write a class such as item that has a name and price. Add objects of item to the bag and find the average and the total of the price of all items in the bag.

  Delete a random element from an arraylist

Elements in an ArrayList and picking one at random to remove. Unfortunately, this slow, since deleting a random element from an ArrayList is slow because of all the shifting. For this question, you should modify the poll()method so that it runs in..

  Define a class called counter an object of this class is

define a class called counter. an object of this class is used to count things so it records a count that is a

  Create dict letter frequencies that reads the file

createDictLetterFrequencies that reads the file and also takes a parameter n. This method should return a dictionary of dictionaries. The outer dictionary associates the previous n letters of a word with an inner dictionary, which indicates the frequ..

  Java program to compute invoice for client

You need a java program to compute the invoice for client and then print out invoice to the screen. The consulting rate is $200 per hour.

  Write class encapsulating the concept of weather forecast

Write a class encapsulating the concept of the weather forecast, assuming that it has the given attributes: the temperature and the sky conditions, which could be sunny, snowy, cloudy, or rainy.

  Program that will calculate monthly mortgage payments

Consumers think of the term of the loan in years, not months.  It would still be good to tell them how many monthly payments they will be making.

  Create the class airplane

Your missions is to create the class Airplane. Each Airplane object should store the following information (fields):

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