473,659 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help With A Grading Program!!

14 New Member
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.ha sNext())
{
quiz1 = grades.next();
quiz2 = grades.next();
midterm = grades.next();
final = grades.next();

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


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


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

}
Dec 7 '06 #1
4 12975
r035198x
13,262 MVP
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.ha sNext())
{
quiz1 = grades.next();
quiz2 = grades.next();
midterm = grades.next();
final = grades.next();

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


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


System.out.prin tln(" 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 New Member
thanks for the help-i am not understanding your question could you re word it
Dec 7 '06 #3
r035198x
13,262 MVP
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 New Member
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
3104
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 we tailor it to fit the problem at hand. I have not been able to attack this one with any kind of success! Does anybody know of a URL that I can get a similar source code for the following problem? Any help would be GREATLY appreciated. ...
1
1436
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 authoring program.? Brent
2
4673
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 a C program that allows the user to make some simple banking
13
2458
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 month. We are assuming that the year will be valid 4 digit integer. So you don't have to think much about that(in terms of validation) except for the month of February. If the month is February, then you have to check whether that year is Leap...
6
1469
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 (2) The program should:
3
2104
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 grade should follow the table below <50 fail 50-59 D 60-69 C 70-79 B 80-89 A 90-100 exellent
4
1552
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 produces the following display on the console: There are xxx circles as follows: Circle 1 has aaa radius and has color ccc Circle 2 has aaa radius and has color ccc Circle 3 has aaa radius and has color ccc …… where there are xxx circles. (I...
3
2377
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 5 4 2 4 4 ***(the first line is the 'answer key'; the first number indicates the total number of answers, and the numbers that follow are the 'correct' answers. the lines following the 'answer key' are the students answers.)***
1
2305
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 from result where schoolcode ='".$_GET."'" ); if(!$sql1) { echo mysql_error();} $sql3 = mysql_query("select count(pass_fail) as totpasstudent from result where schoolcode ='".$_GET."' and pass_fail='p'" ); if(!$sql3) { echo...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.