Anyone have any experience with java?

This topic is locked from further discussion.

Avatar image for SeanDog123
SeanDog123

1327

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#1 SeanDog123
Member since 2005 • 1327 Posts

I need to write a program using loops and if else/switch statements which will prompt the user to enter a number of students, and each of their names and scores, and then print the name of the student with the highest score. I really don't even know where to begin, please help!

Avatar image for Atmanix
Atmanix

6927

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2 Atmanix
Member since 2009 • 6927 Posts

Google

Avatar image for MediumBread
MediumBread

965

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#3 MediumBread
Member since 2010 • 965 Posts

Google

Atmanix

http://lmgtfy.com/?q=google

Avatar image for entropyecho
entropyecho

22053

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#4 entropyecho
Member since 2005 • 22053 Posts

I drink it every morning.

Avatar image for SeanDog123
SeanDog123

1327

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#5 SeanDog123
Member since 2005 • 1327 Posts

[QUOTE="Atmanix"]

Google

MediumBread

http://lmgtfy.com/?q=google

Funny, but I did that and couldn't come up with a solution.
Avatar image for Atmanix
Atmanix

6927

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#6 Atmanix
Member since 2009 • 6927 Posts

[QUOTE="MediumBread"]

[QUOTE="Atmanix"]

Google

SeanDog123

http://lmgtfy.com/?q=google

Funny, but I did that and couldn't come up with a solution.

Google harder.

Avatar image for Necrifer
Necrifer

10629

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#7 Necrifer
Member since 2010 • 10629 Posts

[QUOTE="SeanDog123"]

[QUOTE="MediumBread"]

http://lmgtfy.com/?q=google

Atmanix

Funny, but I did that and couldn't come up with a solution.

Google harder.

Google better.

Avatar image for Engrish_Major
Engrish_Major

17373

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#9 Engrish_Major
Member since 2007 • 17373 Posts
You want us to write your program for you? do you know how loops work? Or have a textbook?
Avatar image for MediumBread
MediumBread

965

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#10 MediumBread
Member since 2010 • 965 Posts

[QUOTE="SeanDog123"][QUOTE="MediumBread"]

http://lmgtfy.com/?q=google

Atmanix

Funny, but I did that and couldn't come up with a solution.

Google harder.

You bad, bad boy.

Avatar image for Atmanix
Atmanix

6927

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#11 Atmanix
Member since 2009 • 6927 Posts

[QUOTE="Atmanix"]

[QUOTE="SeanDog123"]

Funny, but I did that and couldn't come up with a solution.

Necrifer

Google harder.

Google better.

I liked the way mine sounded, even if it is wrong.

Avatar image for brandontwb
brandontwb

4325

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#12 brandontwb
Member since 2008 • 4325 Posts
While (true) { System.out.println ("Do it yourself") } That should work.
Avatar image for deactivated-5c37d3adcd094
deactivated-5c37d3adcd094

8362

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#13 deactivated-5c37d3adcd094
Member since 2006 • 8362 Posts
Tell your teacher that you don't have homework to hand in because the mean folks on the Gamespot forums refused to do it for you. I'm sure they'll understand.
Avatar image for Engrish_Major
Engrish_Major

17373

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#14 Engrish_Major
Member since 2007 • 17373 Posts
While (true) { System.out.println ("Do it yourself") } That should work.brandontwb
I tried that and got a compilation error.
Avatar image for dave123321
dave123321

35554

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#15 dave123321
Member since 2003 • 35554 Posts

I drink it every morning.

entropyecho
Perhaps I will start.
Avatar image for entropyecho
entropyecho

22053

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#16 entropyecho
Member since 2005 • 22053 Posts

[QUOTE="entropyecho"]

I drink it every morning.

dave123321

Perhaps I will start.

Don't do it! You'll be hooked for life. :(

Avatar image for -Big_Red-
-Big_Red-

7230

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#17 -Big_Red-
Member since 2006 • 7230 Posts

[QUOTE="Atmanix"]

[QUOTE="SeanDog123"]

Funny, but I did that and couldn't come up with a solution.

Necrifer

Google harder.

Google better.

Google faster, make it wet.
Avatar image for brandontwb
brandontwb

4325

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#18 brandontwb
Member since 2008 • 4325 Posts
[QUOTE="brandontwb"]While (true) { System.out.println ("Do it yourself") } That should work.Engrish_Major
I tried that and got a compilation error.

Did you import java.initiative?
Avatar image for dave123321
dave123321

35554

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#19 dave123321
Member since 2003 • 35554 Posts

[QUOTE="dave123321"][QUOTE="entropyecho"]

I drink it every morning.

entropyecho

Perhaps I will start.

Don't do it! You'll be hooked for life. :(

Hooked to greatness.
Avatar image for Engrish_Major
Engrish_Major

17373

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#20 Engrish_Major
Member since 2007 • 17373 Posts
Did you import java.initiative?brandontwb
Lol. I'll do it later...
Avatar image for dave123321
dave123321

35554

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#21 dave123321
Member since 2003 • 35554 Posts
Do you need to keep track of all students and corresponding grades?
Avatar image for SeanDog123
SeanDog123

1327

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#22 SeanDog123
Member since 2005 • 1327 Posts
Do you need to keep track of all students and corresponding grades? dave123321
Not sure it just says to print the name of the student with the highest grade. I don't want you guys to do the assignment for me, I don't know how to begin, or what I should loop etc...
Avatar image for dave123321
dave123321

35554

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#23 dave123321
Member since 2003 • 35554 Posts
Have you learned arrays?
Avatar image for James00715
James00715

2484

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#24 James00715
Member since 2003 • 2484 Posts

I you can't do a simple program like this one how will you ever get better? The only way to learn is to beat your head at the problem until your brain figures it out.

Avatar image for Stesilaus
Stesilaus

4999

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#25 Stesilaus
Member since 2007 • 4999 Posts

I'm not familiar with Java syntax, I/O functions, etc., but here's the basic pseudocode:

var NumStudents: int;
var HighestGrade: int;
var BestStudent: String;

// Input NumStudents

HighestGrade = -1;
BestStudent = "(No Data Entered)";

while (NumStudents--)
{
var InputGrade: int;
var InputName: string;
// Input name and grade.
if (InputGrade > HighestGrade)
{
HighestGrade = InputGrade;
BestStudent = InputName;
}
}

// Output BestStudent and HighestGrade.

Avatar image for Farkeman
Farkeman

1199

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#26 Farkeman
Member since 2009 • 1199 Posts
use arrays with for loop to import the data and include a line that compares every array to find the highest i just started java (headfirst books are awesome ) havent started loops yet but from with my pascal knowledge i could write program like that in few minutes :)
Avatar image for SeanDog123
SeanDog123

1327

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#27 SeanDog123
Member since 2005 • 1327 Posts
use arrays with for loop to import the data and include a line that compares every array to find the highest i just started java (headfirst books are awesome ) havent started loops yet but from with my pascal knowledge i could write program like that in few minutes :)Farkeman
Arrays aren't in this chapter, but thanks for the help.
Avatar image for dave123321
dave123321

35554

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#28 dave123321
Member since 2003 • 35554 Posts
The pseudocode is pretty much correct. You should try to figure out why.
Avatar image for SeanDog123
SeanDog123

1327

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#29 SeanDog123
Member since 2005 • 1327 Posts
The pseudocode is pretty much correct. You should try to figure out why. dave123321
That's what I'm doing now.
Avatar image for SeanDog123
SeanDog123

1327

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#30 SeanDog123
Member since 2005 • 1327 Posts

I'm not familiar with Java syntax, I/O functions, etc., but here's the basic pseudocode:

var NumStudents: int;
var HighestGrade: int;
var BestStudent: String;

// Input NumStudents

HighestGrade = -1;
BestStudent = "(No Data Entered)";

while (NumStudents--)
{
var InputGrade: int;
var InputName: string;
// Input name and grade.
if (InputGrade > HighestGrade)
{
HighestGrade = InputGrade;
BestStudent = InputName;
}
}

// Output BestStudent and HighestGrade.

Stesilaus

Thanks a lot! But why is highest grade = -1?

Avatar image for MediumBread
MediumBread

965

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#31 MediumBread
Member since 2010 • 965 Posts

[QUOTE="Stesilaus"]

I'm not familiar with Java syntax, I/O functions, etc., but here's the basic pseudocode:

var NumStudents: int;
var HighestGrade: int;
var BestStudent: String;

// Input NumStudents

HighestGrade = -1;
BestStudent = "(No Data Entered)";

while (NumStudents--)
{
var InputGrade: int;
var InputName: string;
// Input name and grade.
if (InputGrade > HighestGrade)
{
HighestGrade = InputGrade;
BestStudent = InputName;
}
}

// Output BestStudent and HighestGrade.

SeanDog123

Thanks a lot! But why is highest grade = -1?

Because everyone in your class fails?

Avatar image for SeanDog123
SeanDog123

1327

Forum Posts

0

Wiki Points

0

Followers

Reviews: 1

User Lists: 0

#32 SeanDog123
Member since 2005 • 1327 Posts

I'm not familiar with Java syntax, I/O functions, etc., but here's the basic pseudocode:

var NumStudents: int;
var HighestGrade: int;
var BestStudent: String;

// Input NumStudents

HighestGrade = -1;
BestStudent = "(No Data Entered)";

while (NumStudents--)
{
var InputGrade: int;
var InputName: string;
// Input name and grade.
if (InputGrade > HighestGrade)
{
HighestGrade = InputGrade;
BestStudent = InputName;
}
}

// Output BestStudent and HighestGrade.

Stesilaus

Thank you so much! Its working finally, and while I know that programming is about figuring it out and learning, this lab is due tomorrow and I have floor hockey tonight so in this case I didn't have time for all that.

Avatar image for deactivated-5d0e4d67d0988
deactivated-5d0e4d67d0988

5396

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#33 deactivated-5d0e4d67d0988
Member since 2008 • 5396 Posts

Why don't you ask on the java or elicpse forums? You will more than likely get the help you are looking for.

When I had trouble with silverlight, I asked most of my questions on silverlight forums and got what I needed.

Avatar image for nintendo_ds_06
nintendo_ds_06

2657

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#34 nintendo_ds_06
Member since 2006 • 2657 Posts
[QUOTE="Necrifer"]

[QUOTE="Atmanix"]

Google harder.

-Big_Red-

Google better.

Google faster, make it wet.

Oh what the hell..... Google Stronger :P
Avatar image for 194197844077667059316682358889
194197844077667059316682358889

49173

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#35 194197844077667059316682358889
Member since 2003 • 49173 Posts
How has a homework help thread gone so long open?
Avatar image for dave123321
dave123321

35554

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#36 dave123321
Member since 2003 • 35554 Posts
I see an issue. If the highest grade is held by multiple people then the code will only give you one name. An array seems needed if it is going to be taken care of properly .