我如何解决这个开关,if-else语句问题 [英] How do I solved this switch, if-else statement question

查看:84
本文介绍了我如何解决这个开关,if-else语句问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2.奖学金在任何机构都很重要,它是对人类和聪明但贫困学生的社会责任。在学生达到奖学金标准之前,学生可能应该得到一个好的课程。芒福德大学学院打算根据大学的学生类别实施奖学金计划。你被称为java专家,以协助这个方向。

写一个java程序,它将接受四个科目的成绩点和他们的学分时间到gradept []和credithr []的数组中使用扫描仪计算您的成绩点并使用开关,计算每个学生的CGPA,并在活动中显示学生的课程,如下所述。

使用以下

4.0 ............... ..第一堂课

3.0- 3.9 ............ ..第二班上层

2.0- 2.9 ................秒课程较低

1.0-0.9 ...............第三课

使用他们的CGPA,学生可以获得一些学费贷款。

适用于:

4.0 - 3.5 ............... 10000美元,税率为10%。

3.4 - 3.0 ................ 8000美元,含税为8%。

2.9 - 2.5 ...............。6000美元,税率为5%

2.4 - 2.0 ...............。4000美元含税3%。

使用切换输出他们的课程和if-else-if为他们的贷款扣除税后。



我尝试过:



非因为我发现很难解决它

解决方案

引用:

非因为我发现很难解决它



开关只有一个部分问题,你至少可以做其他部分。

如果你不理解开关结构,你可以解决问题网络如果

如果你用解决了问题,一旦你了解开关,您可能会发现两种解决方案并不是彼此相距太远。



首先要做的事情要做的是阅读开关文档,有大量的例子来说明用法。



这是你的作业,我们不会为你做。< br $>
HomeWork不会在乞求其他人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学课程的理解以及问题你应用它们。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。


2.Scholarship is important in any institution, it serves as their social responsibility towards humanity and brilliant but needy students. Before a student meet the scholarship criteria, the student possible should have gotten a good class. Mumford University College intends to implement a scholarship scheme based on the class of students in the university. You have been called as a java expert to assist in this direction.
Write a java program that will accept grade point of four subjects and their credit hours into an arrays of gradept[] and credithr[] using Scanner to calculate your grade point and using switch, calculate the CGPA of each student and in the event display the class of the student as it has been elaborated below.
Use the following
4.0……………..first class
3.0- 3.9…………..second class upper
2.0- 2.9…………….second class lower
1.0-0.9……………third class
Using their CGPA, the students acquire some loans to for their tuition.
For :
4.0 – 3.5……………10000 dollars with a tax of 10%.
3.4 – 3.0…………….8000 dollars with a tax of 8%.
2.9 – 2.5…………….6000 dollars with a tax of 5%
2.4 – 2.0…………….4000 dollars with a tax of 3%.
Use switch out put their classes and if-else-if for their loans after taxes have been deducted.

What I have tried:

Non because am finding difficult to solve it

解决方案

Quote:

Non because am finding difficult to solve it


The switch is only one part of the problem, you can at least do the other parts.
If you don't understand the switch structure, you can solve the problem with a network of if.
If you solved the problem with if, once you understand the switch, you may discover than both solutions are not so far away from each others.

First thing to do is read switch documentation, there is tons of examples to show the usage.

This is your homework, and we will not do it for you.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.


这篇关于我如何解决这个开关,if-else语句问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆