Results 1 to 6 of 6
Thread: School works?
- 11-20-2011, 07:25 AM #1
School works?
Here's a link to the PDF of my homework:
Fall2011Midterm.pdf
My mid term's over. And I was having trouble getting these following questions to compile and work:
- 2(c) (TransformGrades.java)
- 4(b) (NormalGenerate.java)
- 6(b), (c) (FindMinMax.java)
P.S.: I'm a VIM user.
Anyway, please help me out I need to get these three questions to work and handed in to get some additional marks in my midterm as no one seems to be able to get these questions right in my class.
Tim
- 11-20-2011, 07:50 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Re: School works?
(I've closed the duplicate of this thread)
It might help if you could clarify this a bit.I need to get these three questions to work
Do you have code that does not compile? If so, what is the code and what are the compiler messages? If you post them maybe someone help explain what they are getting at.
If it's a matter of the questions asking you to write code, what have you written? If it does compile but does not do at runtime what you expect or intend, say what it does do (including any runtime errors) and describe your intentions or expectations.
If it's a question of how you start, common advice is for you to think about the problem and come up with a way in which *you* rather than a computer might perform the task that has been posed. Try and develop a "recipe" that is both precise and comprehensive. Be able to express that recipe lucidly in natural language before you begin to write code.
-----
Many here won't go to the trouble of downloading files and figuring out what a problem *is*. There is an expectation that you will do this.Last edited by pbrockway2; 11-20-2011 at 07:57 AM.
- 11-21-2011, 11:15 AM #3
Re: School works?
Okay, I got the first one to work with the help from one of my seniors. And I successfully got it to work. Here's the code:
However I don't get this part:public class TransformGrade
{
public static void main(String[] args)
{
int c = 0;
int b = 0;
int a = 0;
for(int i = 0 ;i<args.length ;i++)
{
double grade = Double.parseDouble(args[i]);
if (grade<60) c++;
else if (grade>59 && grade<80) b++;
else a++;
}
System.out.print("C : ");
for (int j = c ;j>0 ;j--)
{
System.out.print("*");
}
System.out.println();
System.out.print("B : ");
for (int k = b ;k>0 ;k--)
{
System.out.print("*");
}
System.out.println();
System.out.print("A : ");
for (int l = a ;l>0 ;l--)
{
System.out.print("*");
}
System.out.println();
}
}
Mind doing some explainations? Thanks.for (int j = c ;j>0 ;j--)
{
System.out.print("*");
}
System.out.println();
System.out.print("B : ");
for (int k = b ;k>0 ;k--)
{
System.out.print("*");
}
System.out.println();
System.out.print("A : ");
for (int l = a ;l>0 ;l--)
{
System.out.print("*");
}
System.out.println();
}
- 11-21-2011, 01:43 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,458
- Rep Power
- 16
Re: School works?
Why don't you ask the person that wrote it?
- 11-21-2011, 01:45 PM #5
-
Re: School works?
Why not go to the tutorials and learn Java, then you can write this yourself *and* understand it. Start here: The Big Index
Similar Threads
-
School project help!
By Addez in forum Advanced JavaReplies: 5Last Post: 09-17-2010, 10:37 PM -
Need help with school project!
By jaxxx in forum New To JavaReplies: 5Last Post: 03-25-2010, 08:55 PM -
Need help with school assignment
By sljkbn in forum New To JavaReplies: 6Last Post: 10-28-2009, 01:07 PM -
Need help with school work
By ccfdet in forum New To JavaReplies: 3Last Post: 08-29-2009, 07:14 PM -
school project help
By justin8790 in forum New To JavaReplies: 5Last Post: 03-22-2009, 09:54 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks