import static void giveintro() { System.out.println(“This program reads

Topic: SciencesPhysics
Sample donated:
Last updated: May 28, 2019

import java.util.*;public class Gradanator { public static void main(String args) {    giveintro(); Scanner console = new Scanner(System.in); double Midterm = Testscore(“Midterm”, console); double Final = Testscore(“Final”, console); double Homework = Homeworkscore(console); Overallgrade(Midterm, Final, Homework); }    public static void giveintro() { System.out.println(“This program reads exam/homework scores”); System.out.println(“and reports your overall course grade.”); System.out.println(); }    public static double Testscore(String test, Scanner console) { final int max = 100;      System.out.println(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 shifted = console.nextInt(); if (shifted == 1){ System.out.print(“Shift amount? “); int shiftamount = console.nextInt();         score += shiftamount; } if (score >= max) {         score = max;      } else {         score = Math.min((int) score, (int) max);      } System.out.println(“Total points = ” + score + ” / ” + max); double shiftedscore = shiftedscore(score, weight, max); System.out.printf(“Weighted score = %.1f / ” + weight + ”

“, shiftedscore, weight); return shiftedscore; }      public static double shiftedscore(int testscore, int testweight, final int max){ return (double)testscore / (double)max * (double)testweight; } public static double Homeworkscore(Scanner console) { final int maxsectionpoint = 30;      final int pointpersection = 5;      System.out.println(“Homework: “); System.out.print(“Weight (0-100)? “); int weight = console.nextInt(); System.out.print(“Number of assignments? “); int numofassignments = console.nextInt(); int orimaxscore = 0; int oriscore = 0; for(int i = 0; i <= numofassignments - 1; i++) { System.out.print("Assignment " + (i+1) + " score and max? "); int score = console.nextInt(); int totalscore = console.nextInt(); orimaxscore += totalscore;         oriscore += score; } System.out.print("How many sections did you attend? "); int sections = console.nextInt(); int sectionpoint = Math.min((sections * pointpersection), maxsectionpoint); System.out.println("Section points = " + sectionpoint + " / " + maxsectionpoint); orimaxscore += maxsectionpoint;      oriscore += sectionpoint; oriscore = Math.min(oriscore, orimaxscore); System.out.println("Total points = " + oriscore + " / " + orimaxscore); double shiftedscore = shiftedscore(oriscore, weight, orimaxscore); System.out.printf("Weighted score = %.1f / " + weight + " ", shiftedscore, weight); return shiftedscore; }    public static void Overallgrade(double Midterm, double Final, double Homework){ double percentage = Midterm + Final + Homework; System.out.printf("Overall percentage = %.1f ", percentage); double GPA; String s; if (percentage >= 85){ GPA = 3.0; s = “Good Job”; } else if  (percentage >= 75) { GPA = 2.0; s = “Nice”; } else if  (percentage >= 60) { GPA = 0.7; s = “It’s alright”; } else { GPA = 0.0; s = “Please drop this class”; } System.out.printf(“Your grade will be at least: %.1f
“, GPA); System.out.println(s); }   }

Don't use plagiarized sources.
Get Your Custom Essay on "import static void giveintro() { System.out.println(“This program reads..."
For You For Only $13.90/page!


Get custom paper

Choose your subject

x

Hi!
I'm Jessica!

Don't know how to start your paper? Worry no more! Get professional writing assistance from me.

Click here