// Example Test (S1234567): Program output is 4.714285...
// Test (Enter your student number here): Program output is ...
import java.util.Scanner; // Needed for the scanner class
// You can add import statements here if you wish
public class Assignment2
{
// Do not make any modifications above this line
public static int mystery(String i)
{
;
double a = new Integer(i);
double c = 0;
double b = 0;
System.out.println("Testing i" + " " + i);
b = (a + a);
c = new Integer(i);
System.out.println("Testing a" + " " + a);
System.out.println ("ading numbers" + " " +b);
// System.out.println ("avg" + " " + (b / index));
return (int) b; // You will need to modify this line
}
public static void runProgram()
{
String i; // to get the keyboard input
double index = 0; //This will hold the count
do {
Scanner keyboard = new Scanner(System.in); //Create a Scabber object to read input
System.out.print("\nPlease enter a Number! "); //get the input from the user from the keyboard
i = keyboard.nextLine();
mystery(i);
index ++;
// System.out.println ("counting the number" + " " + (index ));
// System.out.println ("avg" + " " + (mystery(i) / index));
}while (new Integer(i) > 0);
}
// Do not make any modifications below this line
public static void main(String args[])
{
runProgram();
}
}
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE