Welcome to Katz - Pinoy Underground Forum

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?
  • Compact Safety Notice
  • Weekly Grants Lottery is live! Win a 20,000 ₪ jackpot — tickets are just 30 ₪, drawn every week. Buy your tickets »

Java Grading program

A 626

ampaosampanotoy

Transcendent
Member
Member
12 Year Veteran 12y Veteran
Joined
Jul 24, 2014
Messages
19
Reaction score
3
Points
1
Age
32
grants
₲657
Class Assign7{

// Do you want to declare any member data before you start your "main()" function?
public static void main(String[] args)throws Exception{

// Is "Record.setGP()" a "static method"?
Record.setGP(1.25, 1.25, 0.25, 0.50);

// Isnt this class-wide data? If so, shouldnt you put it *above* "main()"?
int quiz1, quiz2;
int tMidterm, tFinal,tQuiz
int midterm = 0;
int finalExam = 0;
String name;
char grade;


// Do you really want to just bomb out of the program if this fails?
Scanner myIn = new Scanner( new File("scores.txt") );

// Whoa!!!! Why are we starting a new function, *inside of "main()"*?!?!
void getScore()
{
tQuiz = ((quiz1 + quiz2)/20)*.25;
tMidTerm = (midTermExam/100)*.25;
tFinal = (finalExam/100)*.50;
finalScore = tQuiz + tMidTerm + tFinal;
}

// It looks like were starting a new function here, too.
// Wheres your parenthesis and curly brace after "getLetterGrade"????
void getLetterGrade


if (finalScore >= 90)
{
grade = A;
}

// Supposing the grade was "99"?
// Would the student get a "B" here? Or even a "D" below???
if (finalScore >= 80)
{
grade = B;
}


:challenge:

:cool:
:blushing:
 
  • Like
Reactions: Kane
K 0

Kane

Abecedarian
BANNED
Member
Access
Banned
Joined
Oct 10, 2022
Messages
125
Reaction score
66
Points
18
Location
Philippines
grants
₲400
Class Assign7{

// Do you want to declare any member data before you start your "main()" function?
public static void main(String[] args)throws Exception{

// Is "Record.setGP()" a "static method"?
Record.setGP(1.25, 1.25, 0.25, 0.50);

// Isnt this class-wide data? If so, shouldnt you put it *above* "main()"?
int quiz1, quiz2;
int tMidterm, tFinal,tQuiz
int midterm = 0;
int finalExam = 0;
String name;
char grade;


// Do you really want to just bomb out of the program if this fails?
Scanner myIn = new Scanner( new File("scores.txt") );

// Whoa!!!! Why are we starting a new function, *inside of "main()"*?!?!
void getScore()
{
tQuiz = ((quiz1 + quiz2)/20)*.25;
tMidTerm = (midTermExam/100)*.25;
tFinal = (finalExam/100)*.50;
finalScore = tQuiz + tMidTerm + tFinal;
}

// It looks like were starting a new function here, too.
// Wheres your parenthesis and curly brace after "getLetterGrade"????
void getLetterGrade


if (finalScore >= 90)
{
grade = A;
}

// Supposing the grade was "99"?
// Would the student get a "B" here? Or even a "D" below???
if (finalScore >= 80)
{
grade = B;
}


:challenge:

:cool:
:blushing:
Thanks for sharing!
 
Top Bottom