Write a program that prompts the user for student grades and displays the highest and lowest grades in the class. The user should enter a character to stop providing values.
example
Enter as many student grades as you like. Enter a character to stop. |
The highest grade is: 92.0 |
The lowest grade is: 10.65 |
# in java
import java.util.Scanner;
public class StudentMinMaxGrades {
public static void main(String[] args) {
Scanner sc = new
Scanner(System.in);
double min = 1000, max = -1;
double grade;
System.out.println("Enter as many student grades as you like. Enter
a character to stop.");
while (true) {
try {
grade = sc.nextDouble();
} catch
(Exception e) {
//breaking if user enters
break;
}
//checking if
grade is less than min
// make grade as
min
if (grade <
min)
min = grade;
//checking if
grade is greater than max
// make grade as
max
if (grade >
max)
max = grade;
}
//printing the results
System.out.println("The highest
grade is: " + max);
System.out.println("The lowest
grade is: " + min);
}
}
Write a program that prompts the user for student grades and displays the highest and lowest grades in the class.
Write a JAVA program that prompts the user for student grades and displays the highest and lowest grades in the class. The user should enter a character to stop providing values. Starter code: import java.util.Scanner; public class MaxMinGrades{ public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("Enter as many student grades as you like. Enter a character to stop."); double grade = input.nextDouble(); double minGrade = Double.MAX_VALUE; double maxGrade = Double.MIN_VALUE; while (Character.isDigit(grade)) { if (grade == 0)...
Write a program that prompts the user for student grades, calculates and displays the average grade in the class. The user should enter a character to stop providing values.
this is the qestion it has to be in java Example of what i need y Booleato Tools Window Help Hesustor X C C CB https:/class.mimiloassignments/e645f0d9-8eb-4d9b-818-6bb684bBeb/do/90db2810 O Reset to Starter 10 points possible CH4 Exerc. Seved Question 3 Question 3 Write a program that prompts the user for student grades and displays the highest and lowest grades in the class. The user should enter a character to providing values Grading Full Screen • MaxMinGrades.Java New } catch (Exception e) {...
In Python:Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the highest score and the student with the second-highest score. Assume that the number of students is at least 2.
Write a program that asks the user for a student name and asks for grades until the user enters a non-number input, it should then ask if the user wants to enter another student, and keep doing the process until the user stops adding students. The student’s must be stored in a dictionary with their names as the keys and grades in a list. The program should then iterate over the dictionary elements producing the min, max, and mean of...
(Process a string) Write a program that prompts the user to enter a string and displays its length and its first character. java StringLength Enter a string:Does quantum determinacy have anything to with whether human cognition is deterministic? The string is of length 88 and the first character is D import java.util.Scanner; class StringLength{ public static void main (String args[]){ Scanner input = new Scanner(System.in); System.out.println("Enter a string:"); String ans = input.nextLine(); System.out.println("The string...
In Java - Write a program that prompts the user to enter two integers and displays their sum. If the input is incorrect, prompt the user again. This means that you will have a try-catch inside a loop.
using C# Write a program which calculates student grades for multiple assignments as well as the per-assignment average. The user should first input the total number of assignments. Then, the user should enter the name of a student as well as a grade for each assignment. After entering the student the user should be asked to enter "Y" if there are more students to enter or "N" if there is not ("N" by default). The user should be able to...
Write a program that prompts the user for positive integers, only stopping when a negative integer or zero is given. The program should then print out how many of the positive integers were odd. Example: Enter a positive integer (0 or negative to stop): 9 Enter a positive integer (0 or negative to stop): 4 Enter a positive integer (0 or negative to stop): 7 Enter a positive integer (0 or negative to stop): -3 You entered 2 odd integers....
Write a program that prompts the user to enter two characters and displays the major and status represented in the characters. The first character indicates the major and the second is number character 1, 2, 3, 4, which indicates whether a student is a freshman, sophomore, junior, or senior. Suppose the following characters are used to denote the majors: M: MathematicsC: Computer Science T: Testing and Certification