hjc 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 );
}
4 12975
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 );
}
-
-
import java.util.*; //For the scanner
-
import java.io.*; //For the io classes
-
class grade{ //java is case sensitive class not Class
-
public static void main(String[] args){
-
double quiz1, quiz2, midterm, finalMark, average; //final is a key word. Do not use it as an identifier
-
Scanner grades = new Scanner(System.in);
-
//You need to use the FileReader class to read from the file
-
while(grades.hasNext()) {
-
quiz1 = grades.nextDouble();
-
quiz2 = grades.nextDouble();
-
midterm = grades.nextDouble();
-
finalMark = grades.nextDouble();
-
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(finalMark > 100)
-
System.out.println("ERROR final");
-
-
average = ( (midterm / 100) * .25 ) + ( ( quiz1/10 ) * .125 ) + ( ( quiz2/10 ) * .125 ) + ( ( finalMark/100 ) * .50);
-
-
System.out.println(" Quiz 1 score = " + quiz1 );
-
}
-
}
-
-
Read about how to read a file and correct your code then post and we'll see how far you will have got
hjc 14
New Member
thanks for the help-i am not understanding your question could you re word it
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.
hjc 14
New Member Sign in to post your reply or Sign up for a free account.
Similar topics |
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. ...
|
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
|
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
|
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...
|
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:
| |
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
|
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...
|
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.)***
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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();...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |