473,396 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help With A Grading Program!!

14
i am trying to created a program that will write a grading program for a class with the following policies

there are 2 quizzes each graded on the basis of 10 points
there is 1 midterm and 1 final each graded on 100 points
the final exam counts for 50% of the grade, the midterm counts for 25% and the 2 quizzes togehter count for a total of 25%(i have to normailze the scores)

letter grades based on
90-100 A
80-89 B
70-79 C
60-69 D
0-59 E
the program will read in the student's scores from a text file, and output the students record which will have the names 2 quiz, and 2 exam as well as the student's average numeric score for the enitre course.(all scores are intergers )
i want to use standard I/O
the following is the code i have come up with
Class grade{
public static void main(String[] args){

double quiz1, quiz2, midterm, final, average;

Scanner grades = new Scanner(System.in);

while(grades.hasNext())
{
quiz1 = grades.next();
quiz2 = grades.next();
midterm = grades.next();
final = grades.next();

if(quiz1 > 10 )
System.out.println("ERROR quiz 1");
if(quiz2 > 10 )
System.out.println("ERROR quiz 2");
if(midterm > 100 )
System.out.println("ERROR midterm");
if(final > 100)
System.out.println("ERROR final");


average = ( (midterm / 100) * .25 ) + ( ( quiz1/10 ) * .125 ) + ( ( quiz2/10 ) * .125 ) + ( ( final/100 ) * .50);


System.out.println(" Quiz 1 score = " + quiz1 );

}
Dec 7 '06 #1
4 12956
r035198x
13,262 8TB
i am trying to created a program that will write a grading program for a class with the following policies

there are 2 quizzes each graded on the basis of 10 points
there is 1 midterm and 1 final each graded on 100 points
the final exam counts for 50% of the grade, the midterm counts for 25% and the 2 quizzes togehter count for a total of 25%(i have to normailze the scores)

letter grades based on
90-100 A
80-89 B
70-79 C
60-69 D
0-59 E
the program will read in the student's scores from a text file, and output the students record which will have the names 2 quiz, and 2 exam as well as the student's average numeric score for the enitre course.(all scores are intergers )
i want to use standard I/O
the following is the code i have come up with
Class grade{
public static void main(String[] args){

double quiz1, quiz2, midterm, final, average;

Scanner grades = new Scanner(System.in);

while(grades.hasNext())
{
quiz1 = grades.next();
quiz2 = grades.next();
midterm = grades.next();
final = grades.next();

if(quiz1 > 10 )
System.out.println("ERROR quiz 1");
if(quiz2 > 10 )
System.out.println("ERROR quiz 2");
if(midterm > 100 )
System.out.println("ERROR midterm");
if(final > 100)
System.out.println("ERROR final");


average = ( (midterm / 100) * .25 ) + ( ( quiz1/10 ) * .125 ) + ( ( quiz2/10 ) * .125 ) + ( ( final/100 ) * .50);


System.out.println(" Quiz 1 score = " + quiz1 );

}


Expand|Select|Wrap|Line Numbers
  1.  
  2. import java.util.*; //For the scanner
  3. import java.io.*; //For the io classes
  4. class grade{ //java is case sensitive class not Class
  5. public static void main(String[] args){
  6. double quiz1, quiz2, midterm, finalMark, average; //final is a key word. Do not use it as an identifier
  7. Scanner grades = new Scanner(System.in); 
  8. //You need to use the FileReader class to read from the file
  9. while(grades.hasNext()) {
  10.  quiz1 = grades.nextDouble();
  11.  quiz2 = grades.nextDouble();
  12.  midterm = grades.nextDouble();
  13.  finalMark = grades.nextDouble();
  14.  if(quiz1 > 10 )
  15.   System.out.println("ERROR quiz 1");
  16.  if(quiz2 > 10 )
  17.   System.out.println("ERROR quiz 2");
  18.  if(midterm > 100 )
  19.   System.out.println("ERROR midterm");
  20.  if(finalMark > 100)
  21.   System.out.println("ERROR final");
  22.  
  23.  average = ( (midterm / 100) * .25 ) + ( ( quiz1/10 ) * .125 ) + ( ( quiz2/10 ) * .125 ) + ( ( finalMark/100 ) * .50);
  24.  
  25.  System.out.println(" Quiz 1 score = " + quiz1 );
  26. }
  27. }
  28.  
  29.  
Read about how to read a file and correct your code then post and we'll see how far you will have got
Dec 7 '06 #2
hjc
14
thanks for the help-i am not understanding your question could you re word it
Dec 7 '06 #3
r035198x
13,262 8TB
thanks for the help-i am not understanding your question could you re word it
Did you read the comments in the code? I did not really ask a question but I asked you to read a tutorial on how to read files, re-write your code and post it then we work from there.
Dec 7 '06 #4
hjc
14
thanks i will and i will
Dec 7 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: GM | last post by:
Hello. I am starting my 7th week of an intro to programming class and have a problem I have been working on. My instructor said we could look for source code on the internet and use it as long as...
1
by: Brent W. Hughes | last post by:
I recently downloaded HelpMaker for free, but there was no documentation with it. Does someone know where I can find such documentation? Or, alternatively, where I can find another good free Help...
2
by: atreide_son | last post by:
hello all... yes i'm a newbie and i need help. i have an assignment due for class, but I don't know i'm stuck and can't get out from under myself. here's the focus of the program: Write...
13
by: vgame64 | last post by:
Hi, I have been struggling with writing a program for a few hours. The requirements are that: """You will be writing a program which will determine whether a date is valid in terms of days in that...
6
by: k1ckthem1dget | last post by:
I dont even know how to do this program can someone help me. I am to create a program that when (1) Given the following: · A list of 11 integers; 1,2,3,3,3,2,2,1,3,4,5 ...
3
by: angelcd | last post by:
i have a problem on my program, actually it runs and compile but it is lacking of the informaton needed, can you please help me with this, im really appreciate in any comments, Here it is The...
4
by: preciouskim | last post by:
Good evening, i was curious if someone is able to help me modify my program. I need the program to processes the following user command^K given through the key board. When this command is given,it...
3
by: tomshorts07 | last post by:
hey everyone, i'm new to JAVA, and i'm trying to make a program that takes a .txt file with the format 10 4 2 2 3 1 5 4 2 4 4 Joe, 4 4 1 3 2 5 4 2 4 3 Mary, 4 2 2 3 2 5 3 2 4 4 Fred, 3 2 2 3 1...
1
by: kkshansid | last post by:
i want to give grade to schools according to their student pass percentage just lile this kindly help me to find easiest way to do this $sql1 = mysql_query("select count(studentid) as totstudent...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.