•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 423,507 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,664 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 6364 | Replies: 3
![]() |
•
•
Join Date: Jul 2004
Posts: 16
Reputation:
Rep Power: 5
Solved Threads: 0
hi everyone,
i am very new in java. can anyone help me to solve the following problem:
A school conducts a 100 mark exam for its student and grades them as follows:
Grade:
Grade A: Marks>75
Grade B: 75>Marks>60
Grade C: 60>Marks>50
Grade D: 50>Marks>40
Write ajava program to calculate the grades for a student, using if..else statement. use some given value to test the code.
thank you,
regards,
shantuli
i am very new in java. can anyone help me to solve the following problem:
A school conducts a 100 mark exam for its student and grades them as follows:
Grade:
Grade A: Marks>75
Grade B: 75>Marks>60
Grade C: 60>Marks>50
Grade D: 50>Marks>40
Write ajava program to calculate the grades for a student, using if..else statement. use some given value to test the code.
thank you,
regards,
shantuli
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,900
Reputation:
Rep Power: 32
Solved Threads: 118
I'm in a very giving mood today
Usually I don't just give the answer to homework problems outright like I am now. I'd rather see some effort put in on your end. So consider yourself very lucky. The following is the pseudocode for the program. Think about what each line means, and then translate it into Java syntax line by line.
Usually I don't just give the answer to homework problems outright like I am now. I'd rather see some effort put in on your end. So consider yourself very lucky. The following is the pseudocode for the program. Think about what each line means, and then translate it into Java syntax line by line.input student's grade
if grade < 100 AND grade > 75 { student got an A }
else if grade < 75 AND grade > 60 { student got a B }
else if grade < 60 AND grade > 50 { student got a C }
else if grade < 50 AND grade > 40 { student got a D }
else { student got an F } // didn't fit into any of the above scenerios, so must be an F
print to screen what the student got Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Jul 2004
Posts: 6
Reputation:
Rep Power: 0
Solved Threads: 0
Hi shantuli,why not try this code as well.Have a lovely day.
Bobinson.
class Testy
{
byte score;
Testy()
{
score=78;
}
public static void main(String arg[])
{
Testy tst=new Testy();
tst.processGrades();
}
public void processGrades()
{
if
(score >=75)
{
System.out.println("Your grade is A");
}
else
if
((score >= 60)&&( score <75 ))
{
System.out.println("Your grade is B");
}
if
((score >=50 )&&(score<60))
{
System.out.println("Your grade is C");
}
else
if
((score >=40 )&&(score <50))
{
System.out.println(" Your grade is D");
}
else
if
(score <40 )
{
System.out.println(" Sorry you have no part here,FAILED");
}
}
}
Bobinson.
class Testy
{
byte score;
Testy()
{
score=78;
}
public static void main(String arg[])
{
Testy tst=new Testy();
tst.processGrades();
}
public void processGrades()
{
if
(score >=75)
{
System.out.println("Your grade is A");
}
else
if
((score >= 60)&&( score <75 ))
{
System.out.println("Your grade is B");
}
if
((score >=50 )&&(score<60))
{
System.out.println("Your grade is C");
}
else
if
((score >=40 )&&(score <50))
{
System.out.println(" Your grade is D");
}
else
if
(score <40 )
{
System.out.println(" Sorry you have no part here,FAILED");
}
}
}
•
•
Join Date: Jul 2003
Location: Bamberg, Germany
Posts: 117
Reputation:
Rep Power: 6
Solved Threads: 2
Dude, 2 things.
1. Put your code into the [*code] and [/code] tags (remove the * though)
2. Don't just give him the answer to his homework, what good will that do him. You can help him and give him clues, but don't just do it for him. Also, your code seems overly complicated and there is no room for adjustment (i.e. the grade is always 78)
1. Put your code into the [*code] and [/code] tags (remove the * though)
2. Don't just give him the answer to his homework, what good will that do him. You can help him and give him clues, but don't just do it for him. Also, your code seems overly complicated and there is no room for adjustment (i.e. the grade is always 78)
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Help for newbie (C)
- pleeease help somebody (C++)
- student grades program doesnt work how it should (C++)
- Dead end with basic code (C)
- First time using JLabel and JTextArea. Please help!!! (Java)
- Using two vectors? (C++)
- Is it wrong to have a very long program if i did not find another way? (C++)
- applet not showing up (Java)
Other Threads in the Java Forum
- Previous Thread: jave game
- Next Thread: java basic



Linear Mode