Answer to Question #17890 in Java | JSP | JSF for Kahunde Harriet

Question #17890
write a program to grade students' marks and it must accept all inputs in java write a program to calculate the volume of a cylinder given V=pi*r*r*h pi=3.14. and it should accept all inputs
Expert's answer

write a program to grade students' marks and it must accept all inputs injava
import java.util.Scanner;

public class Main {
private static double FinalScore;
private static double HW1;
private static double HW2;
private static double HW3;
private static double HW4;
private static double HW5;
private static double Proj;
private static double Mid1;
private static double Mid2;
private static double Fin;

public static void main(String[] args) {
Scanner input = new Scanner(;
System.out.print("Enter homework 1 : ");
HW1 = input.nextDouble();
System.out.print("Enter homework 2 : ");
HW2 = input.nextDouble();
System.out.print("Enter homework 3 : ");
HW3 = input.nextDouble();
System.out.print("Enter homework 4 : ");
HW4 = input.nextDouble();
System.out.print("Enter homework 5 : ");
HW5 = input.nextDouble();
System.out.print("Enter course project: ");
Proj = input.nextDouble();
System.out.print("Enter midterm exam 1: ");
Mid1 = input.nextDouble();
System.out.print("Enter midterm exam 2: ");
Mid2 = input.nextDouble();
System.out.print("Enter final exam: ");
Fin = input.nextDouble();
System.out.println("Your Final Score is:"+CaluclateGrade());
if(CaluclateGrade()>=93 && CaluclateGrade()<100){
System.out.println("Your Letter Grade is: A");
if(CaluclateGrade()>=90 && CaluclateGrade()<93){
System.out.println("Your Letter Grade is: A-");
if(CaluclateGrade()>=87 && CaluclateGrade()<90){
System.out.println("Your Letter Grade is: B+");
if(CaluclateGrade()>=83 && CaluclateGrade()<87){
System.out.println("Your Letter Grade is: B");
if(CaluclateGrade()>=80 && CaluclateGrade()<83){
System.out.println("Your Letter Grade is: B-");
if(CaluclateGrade()>=77 && CaluclateGrade()<80){
System.out.println("Your Letter Grade is: C+");
if(CaluclateGrade()>=73 && CaluclateGrade()<77){
System.out.println("Your Letter Grade is: C");
if(CaluclateGrade()>=70 && CaluclateGrade()<73){
System.out.println("Your Letter Grade is: C-");
if(CaluclateGrade()>=67 && CaluclateGrade()<70){
System.out.println("Your Letter Grade is: D+");
if(CaluclateGrade()>=63 && CaluclateGrade()<67){
System.out.println("Your Letter Grade is: D");
if(CaluclateGrade()>=60 && CaluclateGrade()<63){
System.out.println("Your Letter Grade is: D-");
if(CaluclateGrade()>=0 && CaluclateGrade()<60){
System.out.println("Your Letter Grade is: F");
private static double CaluclateGrade(){
FinalScore = (HW1+HW2+HW3+HW4+HW5)/5 * 0.3 + Proj * 0.1 + Mid1 * 0.15 +
Mid2*0.15 + Fin * 0.25 + 100 * 0.05;
return FinalScore;

write a program to calculate the volume of a cylinder given V=pi*r*r*h pi=3.14.
and it should accept all inputs

import java.util.Scanner;

public class CalculateTheVolumeOfACylinder {

private static double h=0;
private static double r=0;
private static double V=0;
private static final double pi=3.14;

private static Scanner input =new Scanner(;

public static void main(String[] args) {
System.out.print("Enter h: ");
System.out.print("Enter r: ");
System.out.print("The volume of a cylinder is "+V);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog