Welcome to Dream.In.Code
Become a Java Expert!

Join 149,478 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,613 people online right now. Registration is fast and FREE... Join Now!




Println statements

 
Reply to this topicStart new topic

Println statements

rockstar4cs
17 Apr, 2007 - 08:45 AM
Post #1

D.I.C Head
**

Joined: 16 Apr, 2007
Posts: 73


My Contributions
CODE

private static int determineAboveAverage(int[] n, int cnt, double average) {
int count = 0;
  for (int i = 0; i < cnt; i++)
    if(n[i] > average)
     count++;
  return count;
}
System.out.printf("THE NUMBER OF SCORES ABOVE THE AVERAGE", determineAboveAverage(n,cnt));


CODE

private static int determineBelowAverage(int[] n, int cnt, double average) {
int count = 0;
  for (int i = 0; i < cnt; i++)
    if(n[i] < average)
     count++;
  return count;
}


System.out.printf("THE NUMBER OF SCORES BELOW THE AVERAGE", determineBelowAverage(n,cnt));


I made these to give me the Average below and a group of scores in a array but for some reason when I compile the code it says my println statement is incorrect I'm pretty sure my Above average code is right anyone can tell me if my below is right and how to fix my println statements

This post has been edited by rockstar4cs: 17 Apr, 2007 - 08:47 AM
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Println Statements
17 Apr, 2007 - 08:53 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,348



Thanked: 51 times
Dream Kudos: 25
My Contributions
First of all, you are using printf, not println...is that your intent? Secondly, while providing the value as a parameter, you are not providing any format specifier as to how and where to display it.
User is offlineProfile CardPM
+Quote Post

rockstar4cs
RE: Println Statements
17 Apr, 2007 - 09:00 AM
Post #3

D.I.C Head
**

Joined: 16 Apr, 2007
Posts: 73


My Contributions
Yeah sorry I'm using printF statements thats correct I dont follow u about ur format respons I keep getting the error

determineAboveAverage[int][int,double] in scores can not be applied to [int[]int]

I'm trying to output my method determineAboveAverage to my println statement below

This post has been edited by rockstar4cs: 17 Apr, 2007 - 09:01 AM
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Println Statements
17 Apr, 2007 - 09:14 AM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,348



Thanked: 51 times
Dream Kudos: 25
My Contributions
Your functions take three parameters...but your are only providing them two.
User is offlineProfile CardPM
+Quote Post

rockstar4cs
RE: Println Statements
17 Apr, 2007 - 09:21 AM
Post #5

D.I.C Head
**

Joined: 16 Apr, 2007
Posts: 73


My Contributions
Never mind I figuered out the problem thank you
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 03:44PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month