Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this program ASAP These are some simple exercise for you to practice conditional statements including if, if-else, if else-if and switch case.

Need help with this program ASAP

These are some simple exercise for you to practice conditional statements including if, if-else, if else-if and switch case. You can solve a problem in multiple ways. Try writing different programs for solving the problems and think which one is better and why.

1. Find and print the smallest and the largest of 3 numbers (You can ask the user to enter the 3 numbers from keyboard, if you are familiar with that concept otherwise you can simply initialize the 3 numbers.

2. Assign and print the grade based on the score of a student according to the following conditions (use if, if-else, if else id...whatever works best for you-remember there are multiple ways to do it and achieve what you want.)

Score Grade
90-99 A
80-89 B
70-79 C
60-69 D
<60 F

3. Use a switch-case to implement the same program as discussed in 2 above. (Note: you can not assign range of numbers in a case, you can only use a single number....and you would also not want to write 100 cases for each score....not that it is incorrect but just doesn't look like the right way to approach the problem. So you have to handle this a little smartly by representing the whole range by a single number and use that number in the case statement. Hint: divide the score by 10 and use the answer in your switch statement instead of the original score and similarly change the case statement values as well.)

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 Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

Explain the market segmentation.

Answered: 1 week ago

Question

Mention the bases on which consumer market can be segmented.

Answered: 1 week ago

Question

7. Explain why retirees may be valuable as part-time employees.

Answered: 1 week ago

Question

3. Provide advice on how to help a plateaued employee.

Answered: 1 week ago