
Concept explainers
Explanation of Solution
Program:
File name: “TestGrade.java”
//Import necessary header files
import java.util.*;
//Define a class named TestGrade
public class TestGrade
{
//Define a main method
public static void main(String args[]) throws Exception
{
//Create an object for Scanner class
Scanner input = new Scanner(System.in);
//Declare an array to store eight student ID numbers
int[] ids = {1234, 1245, 1267, 1278, 2345,
1256, 3456, 3478, 4567, 5678
};
//Declare test letter grades
char[] grades = new char[10];
String gradeString = new String();
//Declare the variables and initialize the values
final int HIGHLIMIT = 100;
String inString, outString = "";
int flag = 0;
//For loop to be executed until x exceeds 8
for (int x = 0; x < ids.length; ++x)
{
//Prompt the user to enter a letter grade for the //student
System.out.println("Enter letter grade for student id number: " + ids[x]);
inString = input.next();
grades[x] = inString.charAt(0);
//Try
try
{
TestGrade.isValidGrade(grades[x]);
}
//Catch the GradeException
catch(GradeException e)
{
//Print an appropriate message
System.out.println(e);
//Store I for student for whom
//an exception is caught
grades[x] = 'I';
}
}
//For loop to be executed until x exceeds 8
for (int x = 0; x < ids...

Trending nowThis is a popular solution!

Chapter 12 Solutions
Java Programming (MindTap Course List)
- show all the workarrow_forwardList down the strenghts and weaknesses of your team project for Capsim Simulation? Explan.arrow_forwardCapsim Team PowerPoint Presentations - Slide Title: Key LearningsWhat were the key learnings that you discovered as a team through your Capsim simulation?arrow_forward
- Write the SQL code that permits to implement the tables: Student and Transcript. NB: Add the constraints on the attributes – keys and other.arrow_forwardDraw an ERD that will involve the entity types: Professor, Student, Department and Course. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.arrow_forwardDraw an ERD that represents a book in a library system. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.arrow_forward
- 2:21 m Ο 21% AlmaNet WE ARE HIRING Experienced Freshers Salesforce Platform Developer APPLY NOW SEND YOUR CV: Email: hr.almanet@gmail.com Contact: +91 6264643660 Visit: www.almanet.in Locations: India, USA, UK, Vietnam (Remote & Hybrid Options Available)arrow_forwardProvide a detailed explanation of the architecture on the diagramarrow_forwardhello please explain the architecture in the diagram below. thanks youarrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning




