Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java coding 11. Prompt the user for a letter grade and store this in a char. Then, write a multi-way if statement that ends ina

Java coding

image text in transcribed

11. Prompt the user for a letter grade and store this in a char. Then, write a multi-way "if" statement that ends ina catch-all if a non-existent letter grade (i.e., not A, B, C, D, F) is entered. The multi-way "if" asks: Is the grade an "A"? Else is the grade a "B"? Else is the grade a "C"? Else is the grade a "D? Else is the grade an "F"? For each case, print an appropriate message to screen as to what letter grade was entered (or if a non-existent grade was entered). Notice the use of the word else in the sentence above, which provides for a more precise meaning. In spoken English we might use the word "or" instead, but of course, English is terribly ambiguous and Java needs to be discrete, deterministic, and precise. 12. Write a function called "max" that takes two integers as input and returns the larger of the two. That is, complete the function "public static int max(int a, int b) f" so that it returns the larger of a or b using an "if statement. 13. Ask the user for two integers using a Scanner and report the largest and smallest values using the max function you just built. Consider the following output: //sample output for problem 13 Enter two integers: 2 14 Largest is 14 Smallest is2

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

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago