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

  Javascript program that asks the use

Design a javascript program that asks the user for a username with at least eight characters, beginning with a letter and including at least one digit. Next, write a validation loop to ensure that these conditions have been met

  Ticketmaster

TICKETMASTER - this class will have: a service charge = $8.00 per ticket, tax = .085 current amount of all tickets sold. Its responsibilities are printing a list of events for sale, looking up an event for a customer, and selling a ticket to the e..

  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

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

  Create a secure parts inventory catalog system

You will create a secure Parts Inventory Catalog system using Model 2 architecture. The application will require a user to have the proper access right to enter the system, and when satisfied, presents the catalog of items currently available in t..

  Method called wordlengths that accepts a scanner

Write a method called wordLengths that accepts a Scanner representing an input file as its argument. Your method should read from the given file.

  Write a method called add uneven arrays

Write a method called addUnevenArrays that takes two arrays, a and b, and returns a new array, c, with alength that is the maximum of the lengths of a and b. Each c[i] is the sum of the corresponding elementsof a and b if both elements exist.

  Finding java code error

Indicate in the given code segment if an error occurs. If so, point to whether it is syntax, runtime or logic and how you would fix it.

  Produces a simple formatted report

For this lab you will write a Java program that produces a simple formatted report. The program will prompt the user to enter a file name. This file must contain information in a specific format (detailed below)

  Rewrite the following method using a while loop

Rewrite the following method using a while loop using an Iterator instead of the For each loop, files is an ArrayList storing String objects, also include ANY addition that you would need to have anywhere in the class.

  Explain where the following method invocations

Explain where the following method invocations are most likely to be found in a program for dealing with census data organized using the Model, View, Controller (MVC) design pattern. Choices are zero or more of Model, View, and Controller. Be sure to..

  Describe the equivalence classes

Prove that these relations on the set of all functions from Z to Z are equivalence relations. Describe the equivalence classes.

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