Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment covers: - validating input data - Using exceptions with try/catch - Using conditionals, if/else statements. Also more practice in: - Using the required

image text in transcribedimage text in transcribed

This assignment covers: - validating input data - Using exceptions with try/catch - Using conditionals, if/else statements. Also more practice in: - Using the required Java coding standard for the class. - Using the scanner class to read input from the user. - Parsing Strings into numbers. - Writing static methods Tasks: 1. Make a program that reads a grade percentage as an integer number from the user in the main method (for example the user will enter 83 for 83% ). 2. The program should then send the number to a static method called oal oulateGrade which will calculate a letter grade from this number and return it to the maln method as a string of the form: the letter grade is a - The header for this method should look like this: - public static String calculateGrade(int numIn) 1 - Use the table below for the number to grade conversion in your method. - Number to Grade conversion: - From o to 59 grade is F - From 60 to 69 grade is D - From 70 to 79 grade is C - From 80 to 89 grade is B - From 90 to 100 grade is A 3. The main method should print out the String it gets back from the calculateGrade method, - Your program must validate the user's input - You must check it to make sure it is a number and is within the range of allowed percentage values. I suggest you check for a number in the main, and for the range in the calculate Grade method. - Use tryfcatch and iffelse statements to do this. - First check to see that the user has entered a valid integer number. - If the input is not an integer number, the program should print a message telling the user the error and then exit. It should not call the calculateGrade method! - In calculateGrade check that the number is not less than o or greater than 100. - If number is not in that range, calculateGrade method should return a String explaining the error that the main method will print. - The program should not crash at any point no matter what the user enters. - I will try to crash it and points will be deducted if c can. - Make sure to test "edge conditions" for correctness: - If input is 0 - If input is 100 - if input is 50,60,70,80, or 90 - if input is not a number - if input has a decimal - Make your program user-friendly. - Explain what the program does and guide the user with care, giving lots of instructions and feedback. - Label user errors properly and understandably. - Be sure to format your output nicely so the computing process and the results are understandable. Example input/output (dashed lines are between separate runs of program): Please enter a grade between 0100 97 You got an A Please enter a grade between 0100 50 You got an F Please enter a grade between 0100 78 You got a C Please enter a grade between 0100 E You make a mistake, the score that you enter should be a number from 0100 Please enter a score between 0100 200 You make a mistake, the score that you entered is larger than 100 , it should be a number from on 100 Please enter a score between 0100 9 You make a mistake, the score that you entered is less than 0 , it should be a number from 0 100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

a. Which political changes have occurred within the past 5 years?

Answered: 1 week ago

Question

Be familiar with the integrative servicescape model.

Answered: 1 week ago

Question

Understand the role of corporate design in communications.

Answered: 1 week ago