Results 1 to 15 of 15
- 01-12-2011, 03:47 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
-
Regardless if it's assigned by yourself or by a teacher you blatantly dumped the assignment on us and showed no work. We do not take well to this in either regard. If this doesn't suit you, you are welcome to leave and to ask these types of questions in another forum.
- 01-12-2011, 04:37 AM #3
Listen Wajid,
The expected way to go here is, when you post your questions, we expect to see your attempts to resolve it first.
We don't expect people coming and passing in their [or someone else's] homework assignments to us and expect us to do it for them. That's not how it goes here.
If you have got stuck up somewhere in your code or if your code is throwing some errors, show us the things and you can expect our help. We don't do or support spoon feeding here.
We don't "write" the code for others, we "read" others code/attempts and provide assistance wherever needed. I hope you will understand,
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-12-2011, 04:48 AM #4
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
yes i understand this is my code
I built this code on my basic knowledge
1 import java.io.*;
2 class MarksOfStudents1{
3 int marks[]={67,89,49,95,68,80,74,59,55,57,85,92,87,50,83};
4 for(int i=0; i<=14; i++)
5 {
6 System.out.println("Student marks are :"+sub_marks[i]);
7 }
8 void sumAverage(){
9 int sum=0;
10 double avg=0.0;
11 for(int i=0;i<14;i++)
12 {
13 System.out .println(marks[i]);
14 sum=sum+marks[i];
15 avg=sum/15;
16 System.out.println("marks of students= " +sum);
17 System.out.println("avg");
18 }
19 }
20 void maximumMminimum(){
21 System.out.println("Minimum value="+getMinValue(marks));
22 System.out.println("Maximum value=" + get max value (marks));
23 }
24 void sorting(){
25 for (int i=0;i<14;i++){
26 for (int j=i+1; j<15; j++){
27 if(marks[i]> marks[j]){
28 int x,y;
29 x=marks[i];
30 y=marks[j];
31 marks[i]=y;
32 marks[j]=x;
33 }
34 }
35 }
36 System.out.println("Array after sorting in ascending order");
37 System.out.println();
38 for (int i=0;i<14;i++)
39 System.out.println(marks[i]);
40 }
41 public static void main(String args[]){
42 MarksOfStudents ms =new MarksOfStudents();
43 }
44 }Last edited by wajidameen; 01-12-2011 at 05:17 AM.
- 01-12-2011, 04:54 AM #5
See, you understood that! That's the way :)
Now one more thing, whenever you post your code, use the code tags. For more details refer here: Code Tags
Now, coming back to your code, what is the problem you are facing in this? Errors? Exceptions? Something else?
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-12-2011, 05:12 AM #6
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
47 errors found:
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: illegal start of type
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: ')' expected
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: illegal start of type
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: <identifier> expected
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: ';' expected
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: illegal start of type
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: <identifier> expected
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: <identifier> expected
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: illegal start of type
File: C:\Users\Home\MarksOfStudents1.java [line: 4]
Error: C:\Users\Home\MarksOfStudents1.java:4: <identifier> expected
File: C:\Users\Home\MarksOfStudents1.java [line: 5]
Error: C:\Users\Home\MarksOfStudents1.java:5: ';' expected
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: illegal start of type
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: ';' expected
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: invalid method declaration; return type required
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: illegal start of type
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: ')' expected
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: ';' expected
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: illegal start of type
File: C:\Users\Home\MarksOfStudents1.java [line: 6]
Error: C:\Users\Home\MarksOfStudents1.java:6: ';' expected
File: C:\Users\Home\MarksOfStudents1.java [line: 8]
Error: C:\Users\Home\MarksOfStudents1.java:8: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 10]
Error: C:\Users\Home\MarksOfStudents1.java:10: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 11]
Error: C:\Users\Home\MarksOfStudents1.java:11: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 11]
Error: C:\Users\Home\MarksOfStudents1.java:11: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 11]
Error: C:\Users\Home\MarksOfStudents1.java:11: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 14]
Error: C:\Users\Home\MarksOfStudents1.java:14: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 15]
Error: C:\Users\Home\MarksOfStudents1.java:15: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 16]
Error: C:\Users\Home\MarksOfStudents1.java:16: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 17]
Error: C:\Users\Home\MarksOfStudents1.java:17: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 18]
Error: C:\Users\Home\MarksOfStudents1.java:18: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 22]
Error: C:\Users\Home\MarksOfStudents1.java:22: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 23]
Error: C:\Users\Home\MarksOfStudents1.java:23: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 25]
Error: C:\Users\Home\MarksOfStudents1.java:25: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 25]
Error: C:\Users\Home\MarksOfStudents1.java:25: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 26]
Error: C:\Users\Home\MarksOfStudents1.java:26: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 26]
Error: C:\Users\Home\MarksOfStudents1.java:26: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 29]
Error: C:\Users\Home\MarksOfStudents1.java:29: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 30]
Error: C:\Users\Home\MarksOfStudents1.java:30: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 31]
Error: C:\Users\Home\MarksOfStudents1.java:31: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 32]
Error: C:\Users\Home\MarksOfStudents1.java:32: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 33]
Error: C:\Users\Home\MarksOfStudents1.java:33: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 37]
Error: C:\Users\Home\MarksOfStudents1.java:37: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 38]
Error: C:\Users\Home\MarksOfStudents1.java:38: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 38]
Error: C:\Users\Home\MarksOfStudents1.java:38: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 38]
Error: C:\Users\Home\MarksOfStudents1.java:38: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 40]
Error: C:\Users\Home\MarksOfStudents1.java:40: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 41]
Error: C:\Users\Home\MarksOfStudents1.java:41: class, interface, or enum expected
File: C:\Users\Home\MarksOfStudents1.java [line: 43]
Error: C:\Users\Home\MarksOfStudents1.java:43: class, interface, or enum expected
- 01-12-2011, 05:26 AM #7
Thats what was expected anyways.
I had a look at your code and frankly speaking it's horrible. Sorry for this!
But you have made so many mistakes,
1) You have used method names, which doesn't exist.
2) You are putting your code directly in your class file instead of methods.
3) You are declaring your variables with one name and trying to access them with some other name.
4) You have declared methods, but you are not calling them from anywhere. So you cant expect them to get into the picture.
5) You haven't even created your class object in the right way.
... and so many other things.
I would seriously advice you to go for some good java study; either some good online documentation or some good java book. Do this before attempting to code java, as that would make your concepts good and you will avoid any such mistakes.
Your code is out of scope for any corrections, as the things themselves are not in right place. I hope you will understand,
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-12-2011, 05:39 AM #8
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
A quick bit of advice, try this:
The functions max, min, average, and sort all take an array of something as an argument, in this case int[].Java Code:class AClass { double average(arg){...} int max(arg){...} int min(arg){...} void sort(arg){...} public static void main(String[] args) { int[] x = new int[15]; System.out.println(average(x)); System.out.println(max(x)); System.out.println(min(x)); sort(x); for(int i = 0; i < x.length; i++) { System.out.print(x[i]); } System.out.println(); } }
The only method that really takes a bit of thinking is the sort method. The rest you pretty much have completed, the code seems a little messy, make sure spelling is correct, all statements end with a ;, and so on.
also, as for the sort, you can use built in sorting, to read about it, follow the link:
Java: Sorting Arrays
The general structure of a class should generally be as follows:
This is however very general, but it's all more than enough to achieve what you want.Java Code:class SomeClass { classvar1; classvar2; ... classvarn; method1; method2; ... methodn; public static void main(String[] args) { call methods; manipulate vars and methods; create class instances; ... } }
Hope this helps!Last edited by sunde887; 01-12-2011 at 05:43 AM.
- 01-12-2011, 05:43 AM #9
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
am not a java programmer but a network associate
anyways thanx for all your efforts.
Can anyone complete it now?
- 01-12-2011, 05:48 AM #10
- 01-12-2011, 05:51 AM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,606
- Blog Entries
- 7
- Rep Power
- 17
vWorker.com: More capable, accountable and affordable. Guaranteed.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
-
- 01-12-2011, 02:12 PM #13
There just aren't words to...
- 01-12-2011, 03:18 PM #14
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Quite.
They're trying to learn Java online, and in order to do so they are asking someone else to do the code for them.
- 01-12-2011, 03:19 PM #15
Similar Threads
-
Is There A Way To Call Another Java Program Within A Java Program
By SwissR in forum New To JavaReplies: 4Last Post: 07-30-2010, 12:25 PM -
How would I structure this program? A bit unsure of what is being asked
By babe20042004 in forum New To JavaReplies: 1Last Post: 04-01-2010, 05:14 PM -
Earlier date
By ŖàΫ ỏƒ Ңόρę in forum New To JavaReplies: 3Last Post: 02-07-2010, 06:04 PM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:40 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:33 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks