Create a java project with the name Assignment3YourLastName in the folder COMP3110AssignmentsYourLastName
Part-1 (use a nested-if-else statement)
Add a static method with the name gradeLetter. This method will ask the user to enter an integer score and display the grade letter based on the rules:
|
Score range |
Grade letter |
|
90—100 |
A |
|
80—89 |
B |
|
70—79 |
C |
|
60—69 |
D |
|
0—59 |
F |
Part-2 (use a while statement)
Add a static method with the name CalculateGrade. This method will ask the user to enter 8 scores and product the output as below:
Assignment-3 Part-2:
Enter score 1: 90
Enter score 2: 92
Enter score 3: 67
……
Enter score 8: 98
The sum is nnnn and the average is nnnn!
The scores shown here are just examples. The user can enter any integers as scores. Make sure your method will output the sum and average of the scores which the user entered.
In the main method, call the above two static methods, run and see your program’s output.
Below is your code: -
package COMP3110AssignmentsYourLastName;
import java.util.Scanner;
public class Assignment3YourLastName {
public static void gradeLetter() {
Scanner scan = new
Scanner(System.in);
System.out.print("Enter and integer
score: ");
int score =
Integer.parseInt(scan.next());;
char letter = ' ';
if (score < 60) {
letter =
'F';
} else if (score <= 69) {
letter =
'D';
} else if (score <= 79) {
letter =
'C';
} else if (score <= 89) {
letter =
'B';
} else if (score <= 100) {
letter =
'A';
}
System.out.println("The letter
grade is : " + letter);
}
public static void CalculateGrade() {
Scanner sc = new
Scanner(System.in);
System.out.println("Assignment-3
Part-2:");
int count = 1;
int score;
int sum = 0;
while (count <= 8) {
System.out.print("Enter score " + count + ": ");
score =
Integer.parseInt(sc.next());;
sum = sum +
score;
count++;
}
System.out.println("The sum is " +
sum + " and the average is " + (sum / 8.0) + "!");
}
public static void main(String[] args) {
gradeLetter();
CalculateGrade();
}
}
Output
Enter and integer score: 82
The letter grade is : B
Assignment-3 Part-2:
Enter score 1: 98
Enter score 2: 92
Enter score 3: 85
Enter score 4: 76
Enter score 5: 93
Enter score 6: 94
Enter score 7: 99
Enter score 8: 90
The sum is 727 and the average is 90.875!
Create a java project with the name Assignment3YourLastName in the folder COMP3110AssignmentsYourLastName Part-1 (use a nested-if-else...
SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes numeric scores for a class. The program prompts the users to enter the class size (number of students) to create a single-dimensional array of that size to store the scores. The program prompts the user to enter a valid integer score (between 0 and 100) for each student. The program validates entered scores, rejects invalid scores, and stores only valid scores in the array....
First, create two inputs that can be stored in variables consisting of a student's name. When the program begins ask "Who is the first student?" followed by "Who is the second student?" You only have to have two students for this program. Ask the user for the scores for the last three test grades for each of the students . After the user has entered both names, and three scores for each, the program should display the following as output:...
Solve This Problem using python and please comment on every
line. also, use function to solve this.
thanks
The result will be like as below:
Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following functions in the program: This function should accept five test scores as arguments and return the average of the scores. This function should accept a...
java Part 1 Create a NetBeans project that asks for a file name. The file should contain an unknown quantity of double numeric values with each number on its own line. There should be no empty lines. Open the file and read the numbers. Print the sum, average, and the count of the numbers. Be sure to label the outputs very clearly. Read the file values as Strings and use Double.parseDouble() to convert them. Part 2 Create a NetBeans project...
Declare and initialize 4 Constants for the
course category weights:
The weight of Homework will be 15%
The weight of Tests will be 35%
The weight of the Mid term will be 20%
The weight of the Fin al will be 30%
Remember to name your Constants according to Java
standards.
Declare a variable to store the input for the number of
homework scores and use a Scanner method to read the value from the
Console.
Declare two variables: one...
Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and letterGrade. The user will type a line of input containing the student's name, then a number that represents the number of scores, followed by that many integer scores (user input is in bold below). The data type used for the input should be one of the primitive integer data types. Here are two example dialogues: Enter a student record: Maria 5 72 91 84...
in
java plz
amaining Time: 1 hour, 49 minutes, 15 seconds. Jestion Completion Status: Write a program that asks the user for an input file name, open, read ar number of students is not known. For each student there is a name and and display a letter grade for each student and the average test score fc • openFile: This method open and test the file, if file is not found and exit. Otherwise, return the opened file to the...
Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...
ASSIGNMENT #3 ** using System; namespace GradeCalculatorNew { class MainClass { public static void Main (string[] args) { int test1,test2,test3; double average,average2; char letterGrade; Console.WriteLine("Enter test score1"); test1=Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter test score2"); test2=Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter test score3"); test3=Convert.ToInt32(Console.ReadLine()); average=(test1+test2+test3)/3.0; average=(int)(average+0.5); ...
In Java Main method Your main program will prompt the user for a test name and the number of scores the user will enter. After creating an arraylist to hold the scores, prompt the user for all the scores to hold in the arraylist. After all the scores are entered, then repeat back the score & letter grade. GradeBook Object Create an instance of a GradeBook object and pass the test name and arraylist to set the instance variables. At...