Error On Grade Average Calculator

Jul 15, 2014

I've been learning about Swing and I'm working on a Grade Average Calculator, but the problem is after the user types in the the grades, the average is supposed to appear, but for some reason in my code, nothing appears, I can only type in the grades. Here's my code so far :

package gradecalculator;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.JTextComponent;
import java.awt.*;
public class Gradecalculator extends JFrame implements FocusListener {
JTextField grade1, grade2, grade3, grade4, grade5, grade6, grade7, grade8;

[Code] .....

View Replies


ADVERTISEMENT

Grade Average Project

Dec 7, 2014

I have make a simple grade average project and can't figure out how to ask the user if they want to enter more grades to average and run the app again.Here's what I have so far.

import java.util.Scanner;
public class Average {
private static Scanner kb;
public static void main(String[] args) {
kb = new Scanner(System.in);
 
[code]...

How many grades do you wish to average?

View Replies View Related

Grade Input And Final Average

Sep 15, 2014

For this assignment you will be writing a grade book program. The program will work for one student. It will need to take as input the students name. The user will then be asked to input grades into three categories in this order:

1) homework;
2) quizzes;
3) tests.

The grades in a given category will be averaged to one number that is the average of all grades in that category. The final average will be the weighted average of each category, where homework is worth 25% quizzes are worth 25%, and test are worth 50%. Like this:

Homework Grades: 65, 70, 75, 80, 80 Homework Average: 74
Quiz Grades: 75, 80, 85, 80. Quiz Average: 80
Test Grades: 75, 80, 85, 75 Test Average: 78.75
Final Average = 0.25*HomeworkAvg + 0.25*QuizAvg + 0.50*TestAvg = 77.87

But i only have the average and i dont know how to move past that..

Heres my average code :

import java.util.Scanner;
public class Homework3 {
public static void main(String[] args) {
Scanner myScanner = new Scanner(System.in);
int gradeCount = 0;
int grades = 0;
int holder = 0;

[Code] .....

View Replies View Related

Student Grade Average Program?

Mar 27, 2015

I just have not got the chance to spend much time on it lately I know a bit but I'm not an expert or even intermediate with Java so I'm trying to make a program where the teacher enters the grade of each student and its stored in a variable the only problem is if I use a for loop the variable in which the result will be stired will be overwrite by the last repetition of the loop,I think the idea would be a nested loop but how I would go about using it in this situation,

here is my java code.

import java.util.Scanner;
class maths{
public static void main(String[] args)

[Code].....

View Replies View Related

Basic Grade Calculator

Jan 24, 2015

im considered quite the "javanoob" as my account name states..The assignment is to basically take a number that is entered by a user, and based off what they type in, display a corresponding grade letter. For example, if they enter a number between 90-100, they should receive a response that they received an "A". Now, this is fairly simple using an if/else statement, but my professor wanted us to implement this, using a switch case to teach us the difference.

import java.util.*;
public class SwitchTest
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);

System.out.println("Please enter a number to find out what letter grade you have recieved");

[code]...

View Replies View Related

Grade Calculator Program

Nov 12, 2014

how to I modify my program so that it asks the user how many studens are in the class then according to the value the user inputs that is how many times the program will ask the user for a grade. Once the graded are entered it will then output the class average, minimum, and maximum. I believe that you'd use a for loop yet I am troubled.

import java.util.Scanner;
public class GetLetterGrade{
public static void main(String [] args){
Scanner reader = new Scanner(System.in);

[code]...

View Replies View Related

Grade Average Program - Hit Button Reseved For Calculations

Nov 23, 2014

I have written a simple grade average program. This is my code:

package programs;
 import java.util.Scanner;
 public class GradeAverage {
 public static void main(String[] args) {
 Scanner input = new Scanner(System.in);
int number;
int counter = 0;
int grade;
 
[Code] ....

Now the program is working just fine but what I don't like about it is the fact that you have to enter the number of grades before entering the grades. What I would prefer is to write your grades, hit some button that is reserved for calculating the average and then get the output.

View Replies View Related

Grading System Calculator - Calculate Grade Point Of Three Subjects And Their Credit Hours

Mar 14, 2014

Write a java program that calculate the grade point of three subjects and their credit hours through if the grade points and the credit hours are

Subject---grade---gradepoint-----credit hours
Maths------A--------4.0---------3
English composition-----B-------3.0-----2
French-----B+ ---- 3.3----------3

Now,if the grade point is equal to 4 ,print out First class
If the grade point is equal or greater than 3.0 but less than 4,print out Second class upper
If the grade point is equal or greater than 2.0 but less than 3,print out second class lower
Use the if-else-if statement

View Replies View Related

Max / Min / Average Stats With Error Handling

May 8, 2014

I'm making a program that finds the maximum, minimum, and average values in an integer input ended with a negative number. For example, 4 5 6 -1 is min:4, max:6, and average:5.

It's supposed to handle faulty input in two situations:

1.When an input other than integers is given, the user is given a second chance to give a proper input.

2.When no numbers are given (which is only possible by giving nothing but the negative number end mark), an error message is given because diving by zero integers is impossible.

All the math works fine, but for some reason a proper input in the second chance doesn't. Failing the second chance works, and giving proper input all the way through works. If I fail the first input and then give a proper integer input on the second chance, the program skips over the calculation and gives the divide by zero error. All I could understand from the debugger is that the program is recognizing whatever the first number in that input is, but still keeps the number of numbers as zero (so it's not looping to compare all the numbers in the line either).

import java.util.Scanner;
public class FindNumbers implements FindNumbersInterface
{
double average;
double sum;
int numberOfNumbers;
int total;

[Code] .....

I have a few bits of //old stuff that I've been keeping in case I want to go back.

View Replies View Related

Else Without If Error - Simple Calculator Using JOP

Oct 8, 2014

import javax.swing.JOptionPane;
public class Calculator {
public static void main ( String args[] ) {
double n1 = Double.parseDouble(JOptionPane.showInputDialog(" Enter first number: "));
double n2 = Double.parseDouble(JOptionPane.showInputDialog(" Enter second number: "));
String x = JOptionPane.showInputDialog("Enter operator: ");
double result;

[code].....

Write a program that mimics a calculator. The program will need to accept as input two numeric double values, and accept the operation to be performed as the third input. The operation to be performed will be input in the form of the character representing the java operator for the operation to be performed (i.e + for addition, - for subtraction, * for multiplication, / for division, or % for modulus). Once the program has read these 3 inputs it should output the numbers, the operator, and the result. (For division, if the denominator is zero, the program will output an appropriate message (i.e division by zero is an invalid operation). Please use the JOptionPane class for both accepting the required inputs and for the required output demonstrated below.Some sample output may look as follows:

3 + 4 = 7
13 * 5 = 65
10 / 3 = 3.33333333

Error Messages:
3 errors found:
File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java [line: 23]
Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:23: 'else' without 'if'
File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java [line: 31]
Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:31: 'else' without 'if'
File: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java [line: 37]
Error: /Users/gcaruso/Documents/CISS 110/Module 3/Module 4/Calculator.java:37: 'else' without 'if

View Replies View Related

Having Stack Calculator Error

Jun 3, 2014

I was cannot do the action with + - * /.so i cannot have an output.where is the problem ?

Java Code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.util.Stack;

[code]....

View Replies View Related

Logic Error In Binary Calculator

Oct 31, 2014

int a=Integer.parseInt(jTextField1.getText());
String c = "";
String d="";
if (a>32) {
a-=32;
c+="1";

[Code] ....

I've made this but when i enter a no. than the result comes like eg 9=001001 so i need to delete the zeroes before 1 ....

View Replies View Related

Logic Error In Binary Calculator

Oct 31, 2014

int a=Integer.parseInt(jTextField1.getText());
String c = "";
String d="";
if (a>32)

[Code] ....

I've made this but when i enter a no. than the result comes like eg 9=001001 so i need to delete the zeroes before 1.

View Replies View Related

Displaying GPA And Lower Grade First?

Mar 24, 2015

I have an assignment which i tried to solve myself but there's one part that says "This information should then be displayed with the lowest grade first" which i dont know how to do

Write a Java program that calculates and displays your grade point average (GPA) for the term. Your program should prompt the user to enter the grade and credit hours for each course. This information should then be displayed with the lowest grade first, and the GPA for the term should be calculated and displayed. A warning message should be printed if the GPA is less 2.0 and a congratulatory message if the GPA is 3.5 or above.)

here's my answer:

import java.util.*;
public class Gpa
{static Scanner stdIn= new Scanner(System.in);
public static void main (String[]args)
{
char grade=' ';
int gradevalue=0;
double gpa;

[Code] ....

View Replies View Related

Determining Letter Grade Of Students

Apr 14, 2014

The purpose of this project is to determine the letter grade of students. The program needs to accept two command line arguments:

The first being the name of a disk file that contains the names of students, and their test scores, separated by commas followed by one or more spaces. Each line in the file will contain scores for one student.

The second argument is the name of an output disk file. The program is supposed to create a new output disk file using that name.

The number of students in the input file is unknown during compile time. The name of input and output files could be anything and only known during run time. Additionally, the average scores, along with the minimum and maximum scores for each test are to be displayed in the console.

Calculation: Final Score = quiz1 * .10 + quiz2 * .10 + quiz3 * .10 + quiz4 * .10 + midi * .20 + midii * .15 + final * .25
Final Score >= 90% then letter grade is A, 80%-89% B, 70%-79% C, 60-69% D, <= 59% F

input_data.txt:

firstName lastName, 100, 90, 80, 100, 89, 99, 88
firstName lastName, 90, 90, 100, 100, 99, 100, 95
firstName lastName, 100, 90, 100, 70, 78, 78, 80
firstName lastName, 80, 90, 90, 100, 89, 99, 85
etc.

output_data.txt

firstName lastName: B
firstName lastName: A
firstName lastName: F
firstName lastName: B
firstName lastName: C

averages (to appear in console)
Q1 Q2 Q3 Q4 MidI MidII Final
Average: 82.25 80.38 82.85 83.88 81.38 84.13 78.63
Minimum: 60 54 38 62 62 60 50
Maximum: 100 90 100 100 99 100 95

Press ENTER to continue...

Here's what I have so far :

import static java.lang.System.out;
import java.util.Scanner;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
public class LetterGrader {

[Code] .....

View Replies View Related

Program That Will Accept Values And Transform Scores To Grade

Aug 26, 2014

I was trying to write a program that will accept values and transform the scores to grade. Like 70 and above will be given A from 60 to 69 is B, from 50 to 59 is C, from 40 to 49 is D and below 40 is F. I have defined the variables, for the textfield, am confused on how make this hapen on just a click of the comand botton.

View Replies View Related

Display All Student With Their Grade Sorted From Highest To Lowest

Oct 22, 2014

Write a program that promts a professor to input grades for five different courses for 10 students. Prompt the professor to enter only A,B,C,D, or F for grades(A is the highest grade, F fail). use variables for student number(1 through 10) and grade numbers(1 through 5). create a menu for Search. if the user select search it will prompt a letter correspond to grade. display all student with selected grade. if the user just enter nothing, display all student with their grade sorted from highest to lowest.

View Replies View Related

Java Converting Percentage To Letter Grade - Not Running

Sep 14, 2014

I am trying to create a program that allows me to enter 5 students numeric grade (0-100) to a letter grade (A, B, C, D, F) and I CANNOT use an array. When I try to run my program it says main class not found, and when I change the it from a string to a void in the main method it does not work.

Java Code:

import java.util.Scanner;
public class Week3ControlStatements2
{
public static String main(String[] args){
int numberGrade = 0;
int quotient = numberGrade / 10;
int remainder = numberGrade % 10;

[Code] ....

View Replies View Related

Letter To Numeric Grade Convertor - Return Not Returning

Nov 1, 2014

I have been working on this letter to numeric grade convertor and my return function is not returning anything. Here is my code:

import java.util.Scanner;
public class GradeTest
{
private double numericValue = 0;
private static String grade = "";
public static void main(String[] args)

[code]....

View Replies View Related

Write A Program That Translates A Number Between 0 And 4 Into Closest Letter Grade

Oct 8, 2014

Write a program that translates a number between 0 and 4 into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B. Break ties in favor of the better grade; for example 2.85 should be a B. Use a class Grade with a method getNumericGrade. why when I type .3 it tells me "Exception in thread "main" java.util.InputMismatchException" Or if there is an easier way to do this.

import java.util.Scanner;
public class Grades {
public static void main(String [] args) {
System.out.println("Enter a number between 0 and 4");
Scanner input = new Scanner(System.in);

[code]....

View Replies View Related

Create Random Addition Or Subtraction From 0-500 Depending On Grade Level

Jun 13, 2014

I need creating a code that will create random addition or subtraction from 0-500 depending on their grade level. I know how to create a random for the math and subtraction. I just dont know how to get it to change depending on their grade level. Example I need it to ask their name, grade level, addition or subtraction then five addition or subtraction questions depending on what they chose.

View Replies View Related

User Input Student Information - Print Out Name With Grade In Descending Order

Nov 23, 2014

I had to make a program that allowed the user to enter the number of students and the students names and grades and then print out the name with the grade in descending order. right now I only have it where it prints the names out in descending order. how do I get it the print out with the grade?

Here is my code

import java.util.*; 
public class Grades {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the number of students: ");
int numofstudents = input.nextInt();

[Code] .....

View Replies View Related

Grading Program - Calculate Final Grade By Using Weighted Scoring System

Nov 29, 2014

Many classes calculate a final grade by using a weighted scoring system. For example, "Assignments" might be worth (weighted at) 40% of your final grade. To calculate the portion of the final grade contributed by the Assignments category, the teacher takes the average of all assignments in the category and multiplies it by the weight (40%). So if a student averaged 90% on all assignments, the teacher would take 40% of 90%, or 36 as the weighted average score for the assignment portion of the the final score. The teacher then calculates the weighted average score for each of the other categories (Quizzes, Midterm Exam, Final Exam, etc.), adds them all together to come up with the final score, and assigns a letter grade based on that score.

Write a Java program that allows the teacher to calculate the grade for a student.

Specification :

Prompt the user to enter the Student ID number, first name, last name, and the average score for each of the following categories:

Assignments (worth 50%)
Quizzes (worth 20%)
Midterm Exam (worth 10%)
Final Exam (worth 20%)

Calculate the weighted average score for each category and the total score for the student. Next assign a letter grade as follows:

90 - 100 = A
80 - 89 = B
70 - 79 = C
60 - 69 = D
59 and below = E

Print the results in the following format:

Name: [Last Name], [First Name]
Student ID: [Student ID]
Assignments: [weighted average]
Quizzes: [weighted average]
Midterm Exam: [weighted average]
Final Exam: [weighted average]
Total: [total score]
Final Grade: [letter grade]

Prompt the user to either enter another student or to quit. Continue the process until the user chooses to quit.

I almost done everything but I cant calculate a total score for the student or Assign a letter grade based on the score!!!!
 
package teacher_grade;
import java.util.Scanner;
public class teachergradeing {
public static void main (String[] args) {
//Scanner objective

[Code] ....

View Replies View Related

Switch Statement That Decides What Range To Print Based On Letter Grade Input

Nov 1, 2014

Alright so I wrote a switch statement that decides what range to print based on the letter grade input.

import java.util.Scanner;
public class SwitchPractice
{
public static void main(String [] args)
{
Scanner scan = new Scanner(System.in);

[code]...

It works fine, but once it the user enters a letter grade and then displays the value, it does not prompt the user for another letter grade so that it can perform the output again. Also if I wanted to display an error message to the user if they enter an invalid letter grade how would I do that. I tried using a while loop and if statement in the switch statement but that didn't work.

View Replies View Related

Java Need To Enter 5 Grades And Can Only Enter 1 For Grade Conversion

Sep 13, 2014

How to improve my code. I finally was able to create a program that gives you the corresponding letter grade, when you enter in a numeric grade without using an array. The only issue left is that I have to be able to enter 5 grades at a time, and it give me the letter grade for all 5. I have the programming working, but only am able to enter 1 at a time. I am not sure what kind of loop or if I am supposed to use a loop.

public static void main(String[] args){
{
int grade = 0;
Scanner input = new Scanner(System.in);
System.out.println("Enter : ");
grade = input.nextInt();
if (grade >= 90)

[Code] .....

View Replies View Related

GPA And Average Program

Mar 25, 2014

I am new on this and I will be working in a gpa and average program. This is my code so far: Every time that I try to add the gpa part it gives me errors or just duplicates whatever I've in average and displays it in gpa

/**
* This program shows a database of students in a school.
* It gathers information as name, classes, grades, and calculates average and gpa average.
*
*/
import javax.swing.JOptionPane;
 
[code]....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved