The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I need this to be written in very simple code. The code needs to be something a first semester student would know and you can't use any short cuts. The instructions are below and please try to incorporate this:
The variable declaration and assignment, System.out.print/println, if-else, for-loops, and method
Â
Â
Factoring.java:Â
import java.util.*;
/**
* Factor number
*/
public class Factoring {
/**
* Normal factoring
* @param input long integer
*/
public static void factor(long input) {
long number, divisor;
System.out.print(input + " =");
/*
* Fill this area
*/
System.out.println();
}
public static void factor2(long input) {
}
public static void main(String[] args) {
long input;
Scanner scan = new Scanner(System.in);
while ((input = Tools.getLong(scan, "Enter number: ")) > 0) {
factor(input);
factor2(input);
}
}
}
Tools.java:Â
import java.util.*;
public class Tools {
public static String getNextLine(Scanner keyboard, String prompt) {
System.out.print(prompt);
return keyboard.nextLine();
}
public static String getString(Scanner keyboard, String prompt) {
System.out.print(prompt);
return keyboard.next();
}
public static int getInt(Scanner keyboard, String prompt) {
System.out.print(prompt);
return keyboard.nextInt();
}
public static double getDouble(Scanner keyboard, String prompt) {
System.out.print(prompt);
return keyboard.nextDouble();
}
}