Program (using java) that is suppose to find the largest

Assignment Help JAVA Programming
Reference no: EM13167780

writing a program (using java) that is suppose to find the lowest integer that can be evenly divided by a range (ex. 1-25). I need help fixing/debugging it so it comes up with the proper output. this is the part of my code that does the calculations

 

void main(String[] args){

int num = lowest(1,25);

System.out.println("The smallest divisible number is" + num);

}

public static int lowest(int lower_limit, int upper_limit){

boolean find = false;

int L = upper_limit;

while (find) {

boolean yes = true;

for (int j=lower_limit; j<= upper_limit; j++) {

if (j/L != (L/j ))

break;

yes = false;

}

if (yes){

find = true;

}

else{

L++;

}

}

 

return L;

}

}

 

 

Reference no: EM13167780

Questions Cloud

Unit conversions : Unit Conversions. The following problem generate tables of unit conversions. Include a table heading and column headings for the tables. Choose the number of decimal place based on the values to be printed.
What is the median of the reported blood pressure values : What is the median of the reported blod pressure values?
Saddle point is an element : For a square nXn a array, a saddle point is an element that is the maximum in its row and the minimum in its column.
What is the magnitude of the accumulated difference : The difference is accumulated every 1/10th of a second for one day. What is the magnitude of the accumulated difference
Program (using java) that is suppose to find the largest : writing a program (using java) that is suppose to find the lowest integer that can be evenly divided by a range (ex. 1-25). I need help fixing/debugging it so it comes up with the proper output.
What would be the volume if the pressure were changed : Suppose that a sample of gas occupies 162 mL of volume at 25C and a pressure of 291 torr. What would be the volume if the pressure were changed to 503 torr at 25C? Answer in units of mL.
System by gauss elimination method : Perform six iterations and find absolute approximate error with exact solution. Also solve this system by Gauss elimination method with partial pivoting in order to get exact solution.
Find the pair of compound inequalities : Show the solution sets written algebraically and as a union or intersection of intervals. Describe in words what the solution sets mean, and then display a simple line graph for each solution set as demonstrated
The transmitter and receiver are separated : The transmitter and receiver are separated by a channel (medium of transmission). What types of channels are available?  Please keep it short and simple and please no copy and paste.

Reviews

Write a Review

JAVA Programming Questions & Answers

  How to count number of objects (instances) created

How to count number of objects (instances) Created, use java code and please be descriptive

  Drags html list items to and from a javascript array

1.Write a program which drags html list items to and from a javascript array.2. if an identical list item is already in the array, prevent the list item from dropping in the array. Give an error saying that the list item already exists in the array

  The main method must repeatedly have the use

After the method is defined, the main method must repeatedly have the user enter 3 integers, call the triangleType method and display the return type. Be sure not to have an infinite loop by allowing the user to quit.

  Create a web application for sheridan restaurant

Create a web application for Sheridan Restaurant Reviews that contains the following functionality - Display a table of all restaurants based on the city entered by the user

  A client or server prepare to use udp in a java application

How does a client or server prepare to use UDP in a Java application? Are there any differences in what the client does and what the server does?

  Create web application uses visual web java server

Create the Web application which uses Visual Web Java Server Faces framework and either Apache Tomcat or Glassfish as the server.

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Which a ball is released from a user-defined height

Write a program in which a ball is released from a user-defined height and free-falls to the ground. The ball is pulled by earth's gravity of 9.8 m/sec 2 . Assume that each pixel represents

  Compute the temperature in centigrade

Compute the temperature in Centigrade - Display the temperatures in both Centrigrade and Fahrenheit with appropriate labels, using the + operator to concatenate the labels with the variables

  Program that allows the user to enter the last names

Write a program that allows the user to enter the last names of 5 candidates in a college election and the votes received by each candidate. The program should then output each candidates name, the votes reveived by that candidate

  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 ..

  Create a user interface for a library application

Create a user interface for a library application that allows the user (i.e., the Librarian) to enter Book objects.

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