Question 2: Grade Calculator (Use switch and if) Write a program that takes a student's score...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 2: Grade Calculator (Use "switch" and "if") Write a program that takes a student's score (out of 100) as input and prints out their corresponding grade according to the following scale (use "switch" for this calculation 90-100: A 80-89: B 70-79: C 60-69: D Below 60: F Please validate the input (use "if" and "if ... else" for validation). • The input can be between 0 to 100 inclusive. Integer or real number is allowed, ie. the user can enter 89 or 89.5. If the input is below 0, display "The score has to be zero or above. Please try again.". And wait for another input. If the input is above 100, display "The score has to be below 100. Please try again.". And wait for another input. If the second time input is still invalid, display "It is still an invalid input. Bye!". And the program stops (use System.exit(1), please consult the online JDK API for its meaning). NOTE 2: (i) Neither use nor import any other library/package aside from: java.util.Scanner; (ii) Neither implement nor use any custom/user-defined function(s) for any task herein. (iii) With reference to each task herein, do NOT implement or use any of the following constructs: iterations/loops (for (), while {}, etc.). 4 Figure 6: a normal input between 0 to 100 Welcome to Grade Calculator Enter the student's score (out of 100): 90 The student's grade is: A Figure 7: first input below 0. second input is between 0 to 100 Welcome to Grade Calculator Enter the student's score (out of 100): -18 The score has to be zero or above. Please try again. Ве The student's grade is: B Figure &: first input above 100, second input is between 0 to 100 Welcome to Grade Calculator Enter the student's score (out of 100): 103 The score has to be below 108. Please try again. 67 The student's grade is: D Figure 9: first input above 100, second input is below 0 -****- **** Welcome to Grade Calculator -**** Enter the student's score (out of 100): 185 The score has to be below 100. Please try again. -10 It is still an invalid input. Bye! Question 2: Grade Calculator (Use "switch" and "if") Write a program that takes a student's score (out of 100) as input and prints out their corresponding grade according to the following scale (use "switch" for this calculation 90-100: A 80-89: B 70-79: C 60-69: D Below 60: F Please validate the input (use "if" and "if ... else" for validation). • The input can be between 0 to 100 inclusive. Integer or real number is allowed, ie. the user can enter 89 or 89.5. If the input is below 0, display "The score has to be zero or above. Please try again.". And wait for another input. If the input is above 100, display "The score has to be below 100. Please try again.". And wait for another input. If the second time input is still invalid, display "It is still an invalid input. Bye!". And the program stops (use System.exit(1), please consult the online JDK API for its meaning). NOTE 2: (i) Neither use nor import any other library/package aside from: java.util.Scanner; (ii) Neither implement nor use any custom/user-defined function(s) for any task herein. (iii) With reference to each task herein, do NOT implement or use any of the following constructs: iterations/loops (for (), while {}, etc.). 4 Figure 6: a normal input between 0 to 100 Welcome to Grade Calculator Enter the student's score (out of 100): 90 The student's grade is: A Figure 7: first input below 0. second input is between 0 to 100 Welcome to Grade Calculator Enter the student's score (out of 100): -18 The score has to be zero or above. Please try again. Ве The student's grade is: B Figure &: first input above 100, second input is between 0 to 100 Welcome to Grade Calculator Enter the student's score (out of 100): 103 The score has to be below 108. Please try again. 67 The student's grade is: D Figure 9: first input above 100, second input is below 0 -****- **** Welcome to Grade Calculator -**** Enter the student's score (out of 100): 185 The score has to be below 100. Please try again. -10 It is still an invalid input. Bye!
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class GradeCalculator public static void mainString args create a Scan... View the full answer
Related Book For
Numerical Methods For Engineers
ISBN: 9780071244299
5th Edition
Authors: Steven C. Chapra, Raymond P. Canale
Posted Date:
Students also viewed these programming questions
-
Do you understand the significant uncertainties, or soft spots, inherent in the organization's strategies for achieving its business objectives and performance goals?
-
Daphne bought a house ten years ago for $245,000.The real estate market has had it ups and downs since then. Daphne read a story in todays newspaper that says that during the past decade, houses in...
-
The following are trial balance of Clarissa Amanda Sdn. Bhd. as at 31st December 2021. Debit RM Credit RM Opening stock, 1 Jan 2021 16,000 Purchases 75,000 Sales return 5,000 Carriage inwards 1,500...
-
How are writable CDs implemented?
-
A uniform magnetic field of magnitude 0.150 T is directed along the positive x axis. A positron moving at 5.00 x 106 m/s enters the field along a direction that makes an angle of 85.0° with the x...
-
Restful Sleep Mattress Company is planning to expand into selling bedroom furniture. This expansion will require a loan from the bank. The bank has requested financial information. Discuss, in a...
-
Details of Troy Horse Ltds income statement for the past year are as follows. Required Consider each of the following independent situations. (a) Determine the companys break-even point in units and...
-
The graph that accompanies this question illustrates two demand curves for a firm operating in a differentiated product oligopoly. Initially, the firm charges a price of $60 and produces 10 units of...
-
Draft Components of Financial Analysis and Executive Summary (Mobile app creates personalized nutrition programs for customers based on their diet, health objectives, and lifestyle.) Description:...
-
Suppose there are three types of individuals: high productivity (HP), medium productivity (MP) and low productivity (LP). LP and MP workers amount for a proportion of sizes qL and qM of the entire...
-
1. Consider the following balance sheet (expressed in millions of dollars): Assets Overnight loans: $300 1-year Treasuries: $300 (D* = 0.9 years) 3-year loans: $300 in (D* = 2.5 years) Liabilities...
-
Create problem statement for a research on the resistance to change for the return of tertiary students from online to face to face studies. Please do intext citations and add source of reference.
-
How does Functionalism navigate the complexities of societal change and adaptation, particularly in terms of how institutions evolve to fulfill new functions and accommodate shifting social dynamics?
-
what ways do ecofeminist perspectives analyze the interconnectedness between gender oppression and environmental degradation, highlighting how patriarchal systems exploit both women and nature ?
-
Sales Sregor Company Income Statement $100,000 Cost of Goods Sold 40,000 Gross Profit 60,000 Various operating expenses 25,000 Depreciation expense 4,000 Interest expense 2,000 Net Income before tax...
-
Describe a new insight or perspective gained after reviewing this week's review of the IHI ACA video as it relates to quality and finance. How do you foresee this perspective impacting your practice.
-
determine the area of the region bounded by the given curves and also satisfying any other given conditions. 7. y = 2x-4 and y=x. 1 8. yxe*/2 6 x=1, x = 4, and y = 0. 9. Between T and 3T, bounded...
-
You are standing on the top of a building and throw a ball vertically upward. After 2 seconds, the ball passes you on the way down, and 2 seconds after that, it hits the ground below. a. What is the...
-
Given dxl/dt = 1999x1 + 2999x2 dx2/dt = 2000xl 3000x2 If x1(0) x2(0) = 1, obtain a solution from t = 0 to 0.2 using a step size of 0.05 with the (a) Explicit and (b) Implicit Euler methods.
-
A dye is injected into the circulating blood volume to measure a patients cardiac output, which is the volume flow rate of blood out of the left ventricle of the heart. In other words, cardiac output...
-
Develop a user-friendly program for the FFT based on the algorithm from Figure. Test it by duplicating Figure.
-
What is the difference between old classical and new classical economics?
-
What is the difference between traditional Keynesian and new Keynesian economics?
-
Why does monetary policy operate with a long and variable lag? Give an example to illustrate your explanation.
Study smarter with the SolutionInn App