Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a Java class. I need to get it to compile but I have 3 errors that I can

ID: 3687881 • Letter: T

Question

This is a Java class. I need to get it to compile but I have 3 errors that I can not get rid of.

import java.util.*; // Scanner public class Grades //class { public static void main(String[] args) { Scanner console = new Scanner(system.in); //weighted scores and number of discussions double assign1; double assign2; double assign3; double max1; double max2; double max3; int discuss; int discussMax; System.out.print("Assignment 1 score : "); assign1 = console.nextDouble(); System.out.print("Assignment 2 score : "); assign2 = console.nextDouble(); System.out.print("Assignment 3 score : "); assign3 = console.nextDouble(); System.out.print("Assignment 1 max : "); max1 = console.nextDouble(); System.out.print("Assignment 2 max : "); max2 = console.nextDouble(); System.out.print("Assignment 3 max : "); max3 = console.nextDouble(); System.out.print("Discussions attended : "); discuss = console.nextInt(); System.out.println(); } //determine Weighted Homework score public static double calcWeightedScores(double homeWeight, double exam1Weight, double exam2Weight) { double homeWeight; double exam1; double exam2; double exam1Weight; double exam2Weight; System.out.print("Homework weight : "); homeWeight = console.nextDouble(); System.out.print("Exam 1 score : "); exam1 = console.nextDouble(); System.out.print("Exam 1 weight : "); exam1Weight = console.nextDouble(); System.out.print("Exam 2 score : "); exam2 = console.nextDouble(); System.out.print("Exam 2 weight : "); exam2Weight = console.nextDouble(); System.out.println(); //calculate grade with all Weighted scores public static double grades(weightedHomeworkScore,weightedexam1Score,weightedexam2Score); { double weightedHomeworkScore = (assign1+assign2+assign3+(discuss*4)/max1+max2+max3+discussMax)* homeWeight; return round2(weightedHomeworkScore); double weightedexam1Score = ((exam1/100)*exam1Weight); return round2(weightedexam1Score); double weightedexam2Score = ((exam2/100)*exam2Weight); return round2(weightedexam2Score); } System.out.println("Course grade = " + (int)grades); } //Returns the given double value rounded to the nearest hundredth public static double round2(double n){ return Math.round(n * 100.0) / 100.0; } }

Here is the error info:

Grades.java:65: error: illegal start of expression public static double grades(weightedHomeworkScore,weightedexam1Score,weightedexam2Score); ^ Grades.java:65: error: illegal start of expression public static double grades(weightedHomeworkScore,weightedexam1Score,weightedexam2Score); ^ Grades.java:65: error: ';' expected public static double grades(weightedHomeworkScore,weightedexam1Score,weightedexam2Score); ^ 3 errors ----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete.

import java.util.*/ Scanner public class Grades//class public static void main (String[] args) t Scanner con3ole new Scanner (3y3tem.in) ; /weighted scores and number of discussions double assigni: double assign2: double assign3: double maxl; double max2 double max3; int discuss int discussMax; System.out.print ("Assignment 1 score:" assign! = console. nextDouble ( ) ; System.out.print ("Assignment 2 score:) a33ign2 = console. nextDouble ( ) ; System.out.print ("Assignment 3 score): assign3 console.nextDouble(); System.out.print ("Assignment 1 max") max1 = console. nextDouble ( ) ; System.out.print ("Assignment 2 max: "); max2 = console. nextDouble ( ) ; System.out.print ("Assignment 3 max: "); max3 = console. nextDouble ( ) ; System.out.print ("Discussions attended"); discuss console. next Int ( ) ;

Explanation / Answer

Your code used unncessary functions .. to read inputs .. and in function you are using three return functions .. where it is totally wrong .. After modifications ..

import java.util.*;
// Scanner

public class Grades //class
{
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
//weighted scores and number of discussions
double assign1;
double assign2;
double assign3;
double max1;
double max2;
double max3;
double homeWeight;
double exam1Weight;
double exam2Weight;
int discuss;
int discussMax;
System.out.print("Assignment 1 score : ");
assign1 = console.nextDouble();
System.out.print("Assignment 2 score : ");
assign2 = console.nextDouble();
System.out.print("Assignment 3 score : ");
assign3 = console.nextDouble();
System.out.print("Assignment 1 max : ");
max1 = console.nextDouble();
System.out.print("Assignment 2 max : ");
max2 = console.nextDouble();
System.out.print("Assignment 3 max : ");
max3 = console.nextDouble();
System.out.print("Discussions attended : ");
discuss = console.nextInt();
System.out.print("Discussions Max : ");
discussMax = console.nextInt();
System.out.println();
double exam1;
double exam2;
System.out.print("Homework weight : ");
homeWeight = console.nextDouble();
System.out.print("Exam 1 score : ");
exam1 = console.nextDouble();
System.out.print("Exam 1 weight : ");
exam1Weight = console.nextDouble();
System.out.print("Exam 2 score : ");
exam2 = console.nextDouble();
System.out.print("Exam 2 weight : ");
exam2Weight = console.nextDouble();
System.out.println(); //calculate grade with all Weighted scores
System.out.println ( "Course grade = ");
grades(homeWeight,assign1,assign2,assign3,max1,max2,max3,discussMax,discuss,exam1,exam1Weight,exam2,exam2Weight);
}
  
public static double round2(double n)
{
return Math.round(n * 100.0) / 100.0;
}

private static void grades(double homeWeight, double assign1, double assign2, double assign3, double max1, double max2, double max3, int discussMax, int discuss, double exam1, double exam1Weight, double exam2, double exam2Weight) {
double weightedHomeworkScore = (assign1 + assign2 + assign3 + (discuss * 4) / max1 + max2 + max3 + discussMax) * homeWeight;
System.out.println(round2(weightedHomeworkScore));
double weightedexam1Score = ((exam1 / 100) * exam1Weight);
System.out.println(round2(weightedexam1Score));
double weightedexam2Score = ((exam2 / 100) * exam2Weight);
System.out.println(round2(weightedexam2Score));   
}//Returns the given double value rounded to the nearest hundredth
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote