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 NetBeans, create a Java program called Average.java. The program should use the Scanner class to...
Using NetBeans, create a Java program called Average.java. The program should use the Scanner class to get 4 integers from the user and store them in variables. The program should calculate the average of the 6 numbers as a floating point. Output all of the original input and the calculated average in the Command window. The code is expected to be commented and user-friendly.
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1....
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1. Create an array of string named MONTHS and assign it the values "January - December". All 12 months need to be in the array with the first element being "January", then "February", etc. 2. Using a loop, prompt me to enter an int variable of 1-12 to display the Month of the Year. Once you have the value, the program needs to adjust the...
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1....
Create a Java Program/Class named MonthNames that will display the Month names using an array. 1. Create an array of string named MONTHS and assign it the values "January" through "December". All 12 months need to be in the array with the first element being "January", then "February", etc. 2. Using a loop, prompt me to enter an int variable of 1-12 to display the Month of the Year. Once you have the value, the program needs to adjust the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT