Trying To Create A Program That Provides Average Test Scores

Apr 13, 2014

I keep getting an error that says variable can't be found, what am I missing?

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import java.util.Scanner;
public class testscores extends JFrame

[code]...

View Replies


ADVERTISEMENT

Find Weighted Average Of Four Test Scores

Apr 17, 2015

Write a program in JAVA in response to the following prompt:

Design a GUI program to find the weighted average of four test scores. The four test scores and their respective weights are given in the following format:

testscore1 weight1
...

For example, the sample data is as follows:

75 0.20
95 0.35
85 0.15
65 0.30

The user is supposed to enter the data and press a Calculate button. The program must display the weighted average.

Here is what I have written:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class weightedaverage2 extends JFrame {
private JLabel Score1L,Score2L,Score3L,Score4L;

[Code] .....

View Replies View Related

Create A Program That Shows Three Test Grades And Average

Jan 28, 2015

package Program1;
import java.util.Scanner;
public class Source1 {

[Code].....

using netbeans to debug the program but i'm not sure what I did wrong as it doesnt go past test 1

View Replies View Related

Prompts User To Enter 5 Test Scores And Their Names - Calculate And Display Average

Sep 24, 2014

Using Bluejay. Need code that prompts user to enter 5 test scores and their names. Calculate the average and display.

First initial and last name , 5 test scores, and average

View Replies View Related

Write A Program That Asks Users To Input 5 Test Scores

Apr 22, 2015

Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program:

calculateAverage This method should accept five test scores as arguments and return the average of the scores. determineGrade This method should accept a test score as an argument and return a letter grade for the score, based on the following grading scale

Score Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F

double test1,test2,test3,test4,test5;
double average;
char grade;

Scanner keyboard = new Scanner(System.in);

System.out.println("Enter the first score");
test1 = keyboard.nextDouble();
System.out.println("Enter the second score");
test2 = keyboard.nextDouble();

[code]....

View Replies View Related

Test Score Average Program In Java

Jun 16, 2014

I'm working on a homework assignment and I keep getting a compiler message this is the message

GradesAverage.java:44: error: variable totalgrade might not have been initialized
System.out.println("Over all you have " + totalgrade);
^
1 error

The homework is this Write a program that has variables to hold three test scores. The program should ask the user to enter three test scores and then assign the values entered to the variables. The program should display the average of the test stores and the letter grade that is assigned for the test score average. Use the grading scheme in the following table:

Test Score Average Letter Grade
90-100 A
80-89 B
70-79 C
60-69 D
Below 60 F

This is my code

import javax.swing.JOptionPane; // Needed for JOptionPane class
import java.util.Scanner; // Needed for the scanner class
public class GradesAverage
{
public static void main (String[] args)

[code]....

View Replies View Related

Java Program Using Nested Loop To Compute / Display Average Of Test Results For Each Experiment

Apr 2, 2015

Four experiments are performed, each consisting of six tests. The number of test results for each experiment is entered by the user. Write a Java program using a nested loop to compute and display the average of the test results for each experiment.

You can run the program by entering the following test results:

Experiment 1 results:23.231.516.927.525.428.6
Experiment 2 results:34.845.227.936.833.439.4
Experiment 3 results:19.416.810.220.818.913.4
Experiment 4 results:36.939.549.245.142.750.6

View Replies View Related

Generate Set Of Test Scores Between 0-100 Inconclusive

Dec 8, 2014

Design and write a Java program that will generate a set of test scores between 0-100, inconclusive. The exact umber of scores is determined either randomly or by the user input. There should be a minimum of 5 test scores. The program calculates the average of all test score in this data set. Then it asks the user how many scores are to be dropped and drops that number of low scores. The average is recalculated.

Output of this program:

The original test scores printed in rows of 10 scores
The average before low scores are dropped
The number of low scores to be dropped
The list of low scores dropped
The new average

View Replies View Related

Read Unspecified Numbers Of Scores And Output Average

Sep 5, 2014

Write a program that will read unspecified numbers of scores . The program will output the average of these scores and the scores that are below and above the average.

Example..
1
2
3
4
5
Average is 3
Below 1
2
Above
4
5

View Replies View Related

Validate Names And Test Scores - Logical Error

Oct 14, 2014

I am working in the field of validating data. I need to validate names and test scores and i keeping getting errors in my code. I keep tracing back all the errors and now I am stuck at a logic error. It is giving me a the validate sentence over and over even when i type stuff in. I have searched up how to do the .equals to a string but it doesn't give me a accurate enough to my problem.

import java.util.Scanner;
public class P5A
{
public static void main (String args[]) {
System.out.println( "Always Show" );
Scanner reader = new Scanner(System.in);

[Code] .....

View Replies View Related

Program To Get Quiz Scores

Oct 25, 2014

So for this project I'm going to take in some quiz scores, then eventually get the total number, the range, the mean, and others... Here's the instructions for the two methods I need to create but am completely stuck on:

2. public boolean inputData(Scanner in)
2.1.takes in a Scanner object passed in from main()
2.2. asks the user for a number in the range of 0 through 100.
2.3.It must read a number into an integer variable unless a non-number value is entered, in which case the method will return false. You may use try/catch or an if statement for this.
2.4.If the datum/score seems acceptable, the addGrade method must be called.
2.5.If addGrade returns false, then inputData should throw an IllegalArgumentException or return false
Otherwise, inputData should return true. See section 11.4 for exceptions.

3. public boolean addGrade
3.1.takes in an integer grade. If grade is not in the range of 0 through 100 the method should return false.
Otherwise, it should appropriately change the values of numberOfQuizzes, highValue, lowValue,
3.2.totalQuizScore , sumOfSquares (used in variance calculation), and add one to the count of the proper variable for A's, B's, C's, D's or F's. The method should then call calculate and return true

Now I have done very little with booleans in class at all, so this is all very confusing for me. I've tried to do a lot of research on my own and so far I came up with the following for the two methods above:

public boolean inputData()
{
int score = 0;
System.out.println("Please enter values, Q to quit:");
Scanner in = new Scanner(System.in);
while (in.hasNextInt())

[Code] ....

Honestly I'm not really sure what I'm doing wrong at all, and I have done a lot of research but can't really find anything too similar to what the instructions want so I'm not sure what's right/wrong.

View Replies View Related

Creating Program That Will Handle A Golfer And His Scores

Apr 22, 2015

I have a project that is asking me to create a program that will handle a Golfer and his scores. The program will be comprised of three classes: a Golfer class that will manage all the golfer's scores, a Score class and a Tester class to drive the other classes. To accomplish this task the program will use a partially filled array to store the golfer's scores. I have the majority of the code written. It compiles fine, but when I compile and run it only gives the following output.

Tiger ID Number: 1001 Home Course: Pebble Beach
Score Date Course Course Rating Course Slope
[LScore;@15db9742

I am not sure what I am doing wrong. I have been over and over the code. It is also only printing one golfers information. I have tried creating a for loop for the for the toString in the Golfer class but I am getting the following error Golfer.java:117: error: missing return statement.

I am at a loss here is the code I have for the three sections.

public class Golfer
{
private String name;
private String homeCourse;
private int idNum;
private Score[] scores;
private static int nextIDNum = 1000;

[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

Create A Large Test Array

Mar 2, 2015

In my programming class we need to create a large test array of Longs to iteratively sum/reverse the array and recursively sum/reverse the array.creating the array and where to go from there.

View Replies View Related

Program To Maintain A List Of High Scores Obtained In A Game

Dec 6, 2014

I am stuck on what to put in my functions for this question: Write a program to maintain a list of the high scores obtained in a game. The program should first ask the user how many scores they want to maintain and then repeatedly accept new scores from the user and should add the score to the list of high scores (in the appropriate position) if it is higher than any of the existing high scores. You must include the following functions:

-initialiseHighScores () which sets all high scores to zero.

-printHighScores() which prints the high scores in the format: "The high scores are 345, 300, 234", for all exisiting high scores in the list (remember that sometimes it won't be full).

-higherThan() which takes the high scores and a new score and returns whether the passed score is higher than any of those in the high score list.

-insertScore() which takes the current high score list and a new score and updates it by inserting the new score at the appropriate position in the list

here are my functions the insertScore is missing because I am having troubles with it.

public static void initialiseHighScores (int[] scores, int size)
{
for (int i = 0; i < size; i++)
{
scores [i] = 0;
}
}
public static boolean higherThan (int[] scores, int size, int newScore)
{

[Code]...

View Replies View Related

Create Two Instances Of Class And Test Each Of Methods

Nov 1, 2014

How do I use two constructors and I'm having trouble with using char for gender...

Write a program to test the Person class defined below. Your test program should create two instances of the class (each to test a different constructor) and test each of the methods. You are also required to illustrate the error in trying to access private data members from the client class (for clarity temporarily change the private modifier to public and test again). See screenshots below for sample output.

The screen shots are displayed as:

p1 name = Not Given Age = 0 Gender = U
p2 name = Jane Doe Age = 0 Gender = F
p1 name = John Doe Age = 25 Gender = M

and

PersonTester.jave:20: name has private access in Person
System.out.println("p2 name = " + p2.name + "Age = " + p2.age + "Gender = " + p2.gender);
 PersonTester.jave:20: age has private access in Person
System.out.println("p2 name = " + p2.name + "Age = " + p2.age + "Gender = " + p2.gender);
  PersonTester.jave:20: gender has private access in Person
System.out.println("p2 name = " + p2.name + "Age = " + p2.age + "Gender = " + p2.gender);
 
3 errors

Here is the class given :

class Person {
// Data Members
private String name; // The name of this person
private int age; // The age of this person
private char gender; // The gender of this person
 
[Code] .....

View Replies View Related

Write A JAVA Program That Will Input 10 Scores And Output Highest And Lowest Score

Jan 9, 2015

1.Write a JAVA program that will input 10 scores and output the Highest and Lowest score.

2.Write a JAVA program that will input the base and power and display the result: Example: Base is 4 Power is 2 the answer is 16 (Note: Math.pow( ) method is not allowed)

3.Write a JAVA program that will input an integer number, and then will output the sum of all inputted numbers. The program will stop in accepting inputs if the user entered 0.

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

Program That Has Weighted Average Code

Sep 28, 2014

I am doing a program that has a weighted average calculation and everything compiles and runs. It is just that my weighted average seems to be calculating incorrectly.This is the type of output I should see:

Homework:
Number of assignments? 3
Assignment 1 score and max? 14 15
Assignment 2 score and max? 16 20
Assignment 3 score and max? 19 25
Sections attended? 4
Total points = 65 / 80
Weighted score = 40.63
Exam 1:
Score? 81
Curve? 0
Total points = 81 / 100
Weighted score = 16.2
Exam 2:
Score? 95
Curve? 10
Total points = 100 / 100
Weighted score = 30.0
Course grade = 86.83

Below is my code and I think even after getting up this morning and looking at it, I have an error in the calculations, but I can;t pinpoint it.This program is supposed to receive input from user, and calculated the grades of a student with a weighted average
 
import java.util.Scanner;
public class Grades{
private double weightExam;
private double score;
private double curveAmount;
private double scoreTotal;

[code]...

View Replies View Related

Cannot Get Average Program To Calculate Properly

May 9, 2010

I am having a problem with my program. I can't get my program to calculate properly. Everything compiles and run but its just giving me a wrong answer. I am suposse to get 115.50 but instead I am getting .30...

order.java
public class Order
{
double salesTaxRate; //initializing a variable for the sales tax rate.
double subTotal; //initializing a varliable for the sub total.
double shippingCost; //initializing a variable for shipping cost.
double salesTax; //initializing a variable for sales tax.
double totalCost; // initializing a variable for totale cost.

[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

Average Program - Number Format

May 5, 2015

I am writing a program using a given test drive... I am supposed to write two classes according to the test drive. The calculated correct answer should be 115.50 but i keep getting 115.52 instead and i just can't figure out what i'm doing wrong.

Here is the test drive code:

import java.text.NumberFormat;
public class FinalTester
{
public static void main(String[] args)
{
double avgPurchase;
Order[] lastYear = new Order[4];

[Code] ....

View Replies View Related

How To Write A Program Which Compensate Average

Jan 12, 2015

I have a question. How to write a progamme which compensates an average if it is less than a 10/20. I use eclipse and database HSQLDB. I have a table with notes. After the compensates, I must change the note in my database.

I have three notes

12, 11, 5

The average is 12+11+5/3=9,33

I take the lowest note: 5

12+11+x/3 = 10

12+11+x/3 = 30/3

x=30-23

x=7

The new average is 12+11+7/3=10

View Replies View Related

Can't Connect Nexus7 To Macbook To Test Program

Feb 16, 2014

I started with Eclipse and wrote the basic "Hello World" app and added a few other lines of a=5, b=9, println (a*b) etc. and ran the program in the screen.

Then I thought that perhaps I could move it onto my nexus 7 and see what it looks like there. [I have a lot to learn I suppose].

The first issue is that I can't connect my Nexus 7 tablet to me macbook pro without using "android file transfer" and then the computer does not show the device in the finder because it is running through the file transfer program.

I have done some research and changed the settings in the nexus to connect as a camera rather than storage but that doesn't work either.

So my main issue now is being able to get the program onto the device - can it simply be copied and pasted into one of the files on the device using the file transfer screen?

View Replies View Related

Writing A Program To Test Person Class

Nov 4, 2014

User-defined classes. The concept of getters and setters goes right over my head. Right now we're to write a program to test the Person class below. We have to create 2 instances of the class to test each constructor, and test each method.

class Person {
// Data Members
private String name; // The name of this person
private int age; // The age of this person
private char gender; // The gender of this person
// Default constructor
public Person() {
this("Not Given", 0, 'U');

[code]....

then my output will print out the name. But the assignment doesn't tell us to modify the Person class at all, just to create a tester one.

View Replies View Related

Average Program - Divisible Numbers Not Calculating Correctly

May 21, 2015

For some reason, the averages aren't calculating correctly. I'm aware I need to convert to double if I'm dividing by an odd amount but that itself isn't the issue. It's just simple easy divisible numbers that are not being calculated correctly. For instance, (10 + 10 + 10 + 50) / 4 = should be 2 but I get 10.

Here is the code:

import java.util.Scanner;
public class Avg {
public static void main(String[] args){
Scanner inputGains = new Scanner(System.in);
int userInput = inputGains.nextInt();

[Code] ....

View Replies View Related







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