Question

5) Create a Java program using Scanner: Write a program where you will enter the grade...

5) Create a Java program using Scanner: Write a program where you will enter the grade score for 5 classes, then it will display total points and average and it will display the grade based on percentage.

Steps: 1) Declare variable integer for English, Chemistry, Java Programming, Physics and Math

2) Declare variable total and percentage

3) Create Scanner object and prompt the user to enter grades for each class and input grades after each class

4) Calculate total of all classes

5) Calculate Percentage where total is divided by 500 and then multiplying by 100.

6) Declare if else statement where if percentage is greater than 90 you get A and do the same steps until you reach failing F point

7) Then display total points

8) After that display average of score which is percentage

Homework Answers

Answer #1

Solution:

import java.util.*;

Class StudentGrades {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int English, Chemistry, Java, Physics, Maths, total = 0, percentage = 0;

System.out.println("Enter English grade: ");

English = sc.nextInt();

System.out.println("Enter Chemistry grade: ");

Chemistry = sc.nextInt();

System.out.println("Enter Java grade: ");

Java = sc.nextInt();

System.out.println("Enter Physics grade: ");

Physics = sc.nextInt();

System.out.println("Enter Maths grade: ");

Maths = sc.nextInt();

total = English + Chemistry + Java + Physics + Maths;

percentage = (total/500)*100;

if(percentage >= 90) {

System.out.println("A Grade:);

} else if(percentage >= 80 && percentage < 90) {

System.out.println("B Grade");

} else if(percentage >= 70 && percentage < 80) {

System.out.println("C Grade");

} else if(percentage >=60 && percentage < 70) {

System.out.println("D Grade");

} else if(percentage >=50 && percentage < 60) {

System.out.println("E Grade");

} else {

System.out.println("F Grade");

}

System.out.println("Total points :" + total);

System.out.println("Average score: " + total/5);

return;

}

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
4) Write a Java program using Conditions: Write a program where it will ask user to...
4) Write a Java program using Conditions: Write a program where it will ask user to enter a number and after that it will give you answer how many digits that number has. Steps: 1) Create Scanner object and prompt user to enter the number and declare variable integer for input 2) Use if else condition with && condition where you will specify the digits of numbers by writing yourself the digit number that should display: Example(num<100 && num>=1), and...
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
4) Create the following in a Java program. Create a Scanner Prompt the user to Receive...
4) Create the following in a Java program. Create a Scanner Prompt the user to Receive the amount and declare the variable double amount for scanner Declare variable integer remaining amount which is equal to (int) (amount*100) Find the number of one dollars bt declaring the integer variable which is equal to remaining amount divided by 100 Declare: remaining amount %=100 Find the number of quarters: Declare integer variable number of quarters equal to remaining amount divided by 25 Declare:...
2). Question with methods use scanner (Using Java): You are going to invest the amount, then...
2). Question with methods use scanner (Using Java): You are going to invest the amount, then you going to compute that amount with annual interest rate. 1) Prompt the user to enter student id, student name, student major 2) Declare variables consistent with names that you are prompting and relate them to the scanner 3) Declare the amount invested in college, prompt the user to ask for amount and declare variable and scanner to input 4) Declare the annual interest...
5) Write a java program with scanner object to input first number and second number as...
5) Write a java program with scanner object to input first number and second number as variable with input statement and system out print statement. Steps: 1) Declare scanner object 2) Ask system out print for first number and declare variable first number 3) Ask system out print for second number and declare variable second number 4) Declare first for loop where variable int i has already a value (your choice), that i is less then equal to ? and...
Write a Java program to display a letter grade based on an actual grade. A =...
Write a Java program to display a letter grade based on an actual grade. A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display the letter grade...
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE...
Write a Java program to display a letter grade based on an actual grade. USING ECLIPSE IDE A = 90-100 B = 80-89 C = 70-79 D = 60-69 F = less than 60 The program needs to do the following: 1. Create a short integer to store a grade. (See Week 3 - Things to Know - Java Data Types ) 2. Prompt for a grade ( 0-100). 3. Based on the grade given, use IF statements to display...
Using python, write the program below. Program Specifications: You are to write the source code and...
Using python, write the program below. Program Specifications: You are to write the source code and design tool for the following specification: A student enters an assignment score (as a floating-point value). The assignment score must be between 0 and 100. The program will enforce the domain of an assignment score. Once the score has been validated, the program will display the score followed by the appropriate letter grade (assume a 10-point grading scale). The score will be displayed as...
Java Language: Write an application that asks the user to enter a student ID and a...
Java Language: Write an application that asks the user to enter a student ID and a test letter grade. Create an Exception class names GradeException that contains an Array of valid grade letters that you can use to determine whether a grade entered from the application is valid. In your application, throw a GradeException if the user does not enter a valid letter grade. Catch the GradeException, and then display an appropriate message. In addition, store an 'I' (for incomplete)...
rite a Java Program to play your version of the Texas Pick 3 Lottery. You will...
rite a Java Program to play your version of the Texas Pick 3 Lottery. You will need to include the provided code given below in your program. Task:The program will prompt for a number between 0 and 999. Your program will display the number of attempts it took for the entered number to match a randomly generated number. In the main() method, declare an int named myPick3choice. Create a prompt for myPick3choice as "Enter your Pick 3 choice:0-999". Create a...