Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
OCPJP 6, IBM DB2, IBM RAD Certified
http://javawithsachin.blogspot.in/
OCPJP 6, IBM DB2, IBM RAD Certified
http://javawithsachin.blogspot.in/
OCPJP 6, IBM DB2, IBM RAD Certified
http://javawithsachin.blogspot.in/
OCPJP 6, IBM DB2, IBM RAD Certified
http://javawithsachin.blogspot.in/
OCPJP 6, IBM DB2, IBM RAD Certified
http://javawithsachin.blogspot.in/
No, no, no. Don't go giving a solution like that. That doesn't help at all. Look at Beginning Java, where you readThakur Sachin Singh wrote:char ch;
if(percent>60)
ch='A';
else if(percent>45)
ch='B';
else if(percent>35)
ch='C';
else
ch='F';
you want this solution.
what you want to say...say clear..
Unfortunately I didn't see your response in time to stop you doing any harm. You are depriving other people of the chance to learn by giving a simple answer like that.We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
OCPJP 6, IBM DB2, IBM RAD Certified
http://javawithsachin.blogspot.in/
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Fatfat Tika wrote:are you sure I should divide it by 5 not 4?
![]()
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Don't even try to solve the whole exercise. Get it to print the overall average mark, and forget about the grades.Fatfat Tika wrote: . . . but I can't solve the overall..
Show us how you are working out the average, on paper, and then show us (in a subsequent post) what it looks like in Java™.Fatfat Tika wrote:tnx
what should I do next?
That will give the correct answer, but all those values will be doubles. Probably easiest at this stage to use that formula, remembering to declare your average as a double.Fatfat Tika wrote:prelim:90
midterm:93
semi:80
finals:85
90*.20=18
93*.20=18.6
80*.20=16
85*.40=34
_________
86.6
Forget about if and then until you have the averages working. One little bit at a time.I'm not sure what to write in Java
but I'm thinking of If & Then...
Fatfat Tika wrote:90+93+80*.20=52.6
85*.40=34
_________
86.6
like this??
(90 + 93 + 80 + 2 * 85) ÷ 5, however is an int, and will give the result 86. That is still correct under the rules of integer arithmetic.I earlier wrote:. . . (90 + 93 + 80 + 2 * 85) ÷ 5.0 . . .
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |