Posted: November 28th, 2023
Java Programming help using scanner, if/else statements, and parameters.
Assessment Brief
I'm having problems with my homework: this is the specification (I have provided screenshots). I get a compiler error for the last line. Any help is appreciated. I'm posting what I have so farimport java.util.*;public class Gradanator { final int maximum = 100; // sets the cap to 100 public static void main(String[] args) { Scanner console = new Scanner(System.in); intro(); double midterm = test("Midterm", console, 100); double Final = test("Final", console, 100); double homework = homework_score(console); grade_report(midterm, Final, homework); } // this method introduces the program to the user public static void intro() { System.out.println("This program reads exam/homework scores"); System.out.println("and reports your overall course grade."); System.out.println(); } // this method prompts the user to input details about the midterm or the final // and calculates the scores public static double test(String test,Scanner console, int maximum) { System.out.print(test + ":" ); System.out.print("Weight(0-100)? "); int weight = console.nextInt(); System.out.print("Score earned? "); int score = console.nextInt(); System.out.print("Were scores shifted (1 = yes, 2 = no)? "); int shift = console.nextInt(); if (shift == 1) { System.out.print("Shift amount? "); int shift_amount = console.nextInt(); score += shift_amount; } else { score = Math.min(score, maximum); } System.out.println("Total points = " + score + "/" + maximum); double weighted = score_weight(score, weight, maximum); System.out.print("Weighted score = ", weighted, weight); return weighted; System.out.println(); return score; } // this method prompts the user to input information about their homework // and calculates the score public static double homework_score(Scanner console) { final int maximum_section_points = 30; final int points_every_section = 5; Sytem.out.println("Homework:"); System.out.print("Weight (0-100)? "); int weight = console.nextInt(); System.out.print("Number of assignments? "); int assignment_number = console.nextInt(); int homework_max = 0; int homework_score = 0; for (int i = 0; i < assignment_number; i++) { System.out.print("Assignment" + (i + 1) + "score and max? "); int score = console.nextInt(); int maximum_score = console.nextInt(); homework_max += maximum_score; homework_score += score; } Sytem.out.print("How many sections did you attend? "); int section = console.nextInt(); int section_points = Math.min((section * points_every_section), maximum_section_points); System.out.println("Section points = " + section_points + "/" + maximum_section_points); homework_score += section_points; homework_max += maximum_section_points; System.out.println("Total points: " + homework_Score + "/" + homework_max); double weighted = score_weight(homework_score, weight, homework_max); System.out.print("Weighted score = ", weighted, homework_max); return weighted; } // this method will calculate the percentage that the user got public static void grade_report(double midterm, double Final, double homework) { double percent = midterm + Final; System.out.println("Overall percentage = ", percent); double minimum_grade; String confirmation; if (percent >= 85) { minimum_grade = 3.0; System.out.println("You did great!"); } else if (percent >= 75) { minimum_grade = 2.0; System.out.println("You were average."); } else if (percent >= 60) { minimum_grade = 0.7; System.out.println("You did enouugh to pass."); } else { minimum_grade = 0.0; System.out.println("Do better next time. Fighting!"); } System.out.print("Your grade will be at least: ", minimum_grade); System.out.println(confirmation); } public static double score_weight(int score, int weight, final int maximum_score) { return ((double) score / double maximum_score) * double weight; }}
Can I Review Writer Profiles?
Yes, check anonymized profiles showcasing our writers qualifications and expertise to feel confident in your papers quality. This transparency ensures you are paired with the right expert. Profile information includes educational background and subject specializations for informed selection. Browse profiles or let us match you with the best fit. Essay writer credentials are transparently displayed for informed decision-making.
Order | Check Discount
Tags: Research Essay Support, PhD Dissertation Help, Online Homework Help, Custom Essay Writing