473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Unable 2 compile

Please I'm trying to compile the program. I'm being asked for a return type and variable. Please could u fix it. The program is meant 2 calculate the mean of up to 10000 randomly generated numbers. Thanks


Expand|Select|Wrap|Line Numbers
  1.  class Test1 
  2.     {
  3.  
  4.     static float mu1,mean1;
  5.  
  6.     public static void setMean(float mu1) 
  7.         {    
  8.                mean1=mu1;
  9.          }
  10.     public static float[] generateRandom()
  11.         {    
  12.         Random generator = new Random();
  13.         float total=0.0f;
  14.  
  15.         int count = 10000;
  16.  
  17.         for(int i = 0; i<count; i++){
  18.             total += (float)generator.nextGaussian();
  19.  
  20.         float am[] = new float[2];
  21.         am[0] = total; 
  22.         }
  23.     }    
  24.   }
  25.  
  26.  
  27. public class Test
  28.  
  29.     {
  30.         public static void main(String[] args)
  31.  
  32.         {
  33.  
  34.         Test1 bgg = new Test1();
  35.  
  36.         bgg.setMean(1.0f);
  37.  
  38.         float[] x = bgg.generateRandom();
  39.  
  40.         System.out.println("["+ x[0]+"]");
  41.  
  42.              }
  43.     }
Jul 22 '07 #1
3 1114
prometheuzz
197 Expert 100+
Please I'm trying to compile the program. I'm being asked for a return type and variable. Please could u fix it. The program is meant 2 calculate the mean of up to 10000 randomly generated numbers. Thanks
No, I'm not going to fix it. But if you copy-n-paste the compiler errors, I'll (try to) help you with them so that you can fix it yourself. Do we have a deal?
Jul 22 '07 #2
No, I'm not going to fix it. But if you copy-n-paste the compiler errors, I'll (try to) help you with them so that you can fix it yourself. Do we have a deal?
Here it is:

C:\Documents and Settings\Grabonlee\Desktop\Rework1>javac Test.java
.\Test1.java:27: missing return statement
}
^
1 error

C:\Documents and Settings\Grabonlee\Desktop\Rework1>
Jul 22 '07 #3
In your code
public static float[] generateRandom()
{
//enclosing block
}
The return statement must be float[] according to " public static float[] generateRandom() " but you have not given any return statement within the enclosing block.
Jul 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Wayno | last post by:
Hoping someone can help me out with this problem. First problem, is I am unable to view my php error log. In my php.ini I have my log in /var/www/logs/php_error_log. However, it has remained empty....
0
by: mkent | last post by:
I have a vexing problem and seek some input on how to fix it. Starting with Python 2.4.0, I have been unable to compile a working Python on our AIX 4.3.3 development system. I can compile a...
3
by: Mike Thomas | last post by:
We have an app running on Citrix which I am trying to turn into an MDE. It is in Access 2000. The frontend application is now about 16 mb. The backend database consists of tables linked into the...
8
by: Chris Bailiss | last post by:
Hi all, I am unable to run any VBA in access XP. I get the compile error of 'Error In Loading DLL'. Behaviour of the wizards is also patchy. I cannot get past the first screen in most (i.e....
3
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency...
0
by: ufnuceda | last post by:
Hello everyone, I was wondering if any of you have some experience with the boost library. I am having trouble compiling code with it. Since boost is being used a lot these days I thought some...
9
by: MAF | last post by:
Does anyone know why in 2005 I might be getting this error everytime I try and recompile? Error 226 Unable to copy file "obj\Debug\myfile.dll" to "bin\Debug\myfile.dll". The process cannot...
2
by: Paul Cheetham | last post by:
Hi, I have moved an application from VS2003 to VS2005, and I am now unable to view most of my forms in the designer. The majority of the forms in my project are derived from class PACForm,...
4
by: shaileshkumar | last post by:
hi , i m trying to run jsps in tomcat 5.0. I was able run servlets successfully but iam unable to run jsps. i have also coppied tools.jar from jdk and pasted in tomcat directory i have done the...
3
by: =?Utf-8?B?TGV3aXMgTW90ZW4=?= | last post by:
Hello. We are having a problem here trying to compile C# applications. Only one developer has a problem where they attempt to compile the application and the compiler complains about being out of...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.