File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Please anyone I need help with my homework. I'm so desperate. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please anyone I need help with my homework. I Watch "Please anyone I need help with my homework. I New topic
Author

Please anyone I need help with my homework. I'm so desperate.

mimi ventimiglia
Greenhorn

Joined: Nov 28, 2008
Posts: 1
It will mean so much to me if any of you guys can help me. I'm so stupid at this.I learn real quick when I look at them. i don't want to waste any of you guys time by explaining it to me. The fact that anyone can do this is amazing. Here it is:



1.)Write a program that asks the user for 5 test scores in a loop and keeps track of their sum. You should NOT store all of the individual test scores. (do not make 5 variables)

Sample:
Enter a test:99
Enter a test:100
Enter a test:101
Enter a test:50
Enter a test:55
The total is 405

2.) Modify the program so that it prints the average instead of the sum.

Sample:
Enter a test:99
Enter a test:100
Enter a test:101
Enter a test:50
Enter a test:50
The Your average is 80.0

3.) Modify the program so that it asks for 10 test scores, then 15 test scores. Can you make this any number?

4.) Modify the program so that in the beginning of the program it asks the user "How many tests did you take" and then will ask the user for THAT many test scores.

Sample:
Enter a test:99
Enter a test:98
Enter a test:98
Your test average is 98.3333333333333.


Sample:
How many tests did you take? 6
Enter a test:80
Enter a test:80
Enter a test:80
Enter a test:80
Enter a test:81
Enter a test:81
Your test average is 80.5
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

Please Do Your Own Homework. We will guide you where needed but we will not give you full solutions.

I'll give you a few hints:
- solution 2 is basically solution 1 with a divide operation added (average == sum / count). Take care though that integer division may not result in what you expect. You may need to cast some values to float or double.

- use a loop; for is probably the easiest

- if you are allowed to, check out java.util.Scanner for reading the values. Otherwise you will need to use System.in combined with Integer.parseInt. You can make life a bit easier by wrapping System.in in an InputStreamReader in a BufferedReader.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11301
    
  16

Originally posted by mimi ventimiglia:
i don't want to waste any of you guys time by explaining it to me.
But that is exactly what we DO here, is explain things. If all you want is someone to write it for you, you can post in Jobs Offered or try some of the rent-a-coder sites.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please anyone I need help with my homework. I'm so desperate.