早教吧作业答案频道 -->其他-->
java考试题请求各位大神帮个忙能答多少答多少人多力量大谢谢大家了。!!1)Writeamethodthatreceivestwointparametersandreturnsthesmallerofthetwovalues.CallyourmethodgetSmaller.2)Writeamethodt
题目详情
java 考试题 请求各位大神帮个忙 能答多少 答多少 人多力量大 谢谢大家了。!!
1) Write a method that receives two int parameters and returns the smaller
of the two values. Call your method getSmaller.
2) Write a method that receives two String objects and returns true if the
two Strings start with the same character (ignoring case) and false
otherwise.
3) Using the Die class, write a method that will use two Die, roll them
100 times and return the number of times that the sum of the two is
7 or 11.
For questions 4 and 5, write the requested portions of a class called Employee.
4) An Employee will have a name, social security number, position, and
hourly wages. Define the instance data for this class.
5) Write a method that is passed the int value of the number of hours worked
for the week as a parameter, and returns the pay for the Employee,
including overtime, which is 1.5 * hourly wages for each hour over 40.
1) Write a method that receives two int parameters and returns the smaller
of the two values. Call your method getSmaller.
2) Write a method that receives two String objects and returns true if the
two Strings start with the same character (ignoring case) and false
otherwise.
3) Using the Die class, write a method that will use two Die, roll them
100 times and return the number of times that the sum of the two is
7 or 11.
For questions 4 and 5, write the requested portions of a class called Employee.
4) An Employee will have a name, social security number, position, and
hourly wages. Define the instance data for this class.
5) Write a method that is passed the int value of the number of hours worked
for the week as a parameter, and returns the pay for the Employee,
including overtime, which is 1.5 * hourly wages for each hour over 40.
▼优质解答
答案和解析
前两题,后面的继续给你写
public int getSmaller(int a,int b){
if(a<=b){
return a;
}else{
return b;
}
}
public boolean checkFirstLetter(String a,String b){
if(a.toLowerCase().charAt(0)==b.toLowerCase().charAt(0)){//不区分大小写,区分的话把.toLowerCase()去掉
return true;
}else{
return false;
}
}
第四题
public class Employee {
private String name="小明";
private String socialSecurityNumber="abcdefg";
private String position="图书管理员";
private Float hourlyWages=5.0f;
public String getName() {
return name;
}
public String getSocialSecurityNumber() {
return socialSecurityNumber;
}
public String getPosition() {
return position;
}
public Float getHourlyWages() {
return hourlyWages;
}
}
第五题
public Float getPayForEmployee(int hour){
Float wages=0f;
Employee e=new Employee();
if(hour >40){
wages=(hour-40)*e.getHourlyWages()+40*e.getHourlyWages();
}else{
wages=40*e.getHourlyWages();
}
return wages;
}
第三题我再看看是什么意思
public int getSmaller(int a,int b){
if(a<=b){
return a;
}else{
return b;
}
}
public boolean checkFirstLetter(String a,String b){
if(a.toLowerCase().charAt(0)==b.toLowerCase().charAt(0)){//不区分大小写,区分的话把.toLowerCase()去掉
return true;
}else{
return false;
}
}
第四题
public class Employee {
private String name="小明";
private String socialSecurityNumber="abcdefg";
private String position="图书管理员";
private Float hourlyWages=5.0f;
public String getName() {
return name;
}
public String getSocialSecurityNumber() {
return socialSecurityNumber;
}
public String getPosition() {
return position;
}
public Float getHourlyWages() {
return hourlyWages;
}
}
第五题
public Float getPayForEmployee(int hour){
Float wages=0f;
Employee e=new Employee();
if(hour >40){
wages=(hour-40)*e.getHourlyWages()+40*e.getHourlyWages();
}else{
wages=40*e.getHourlyWages();
}
return wages;
}
第三题我再看看是什么意思
看了java考试题请求各位大神帮个...的网友还看了以下:
写出等式中未知的分子或分母(1)(x+y)()分之x()=()分之xy+x²还有第2题a-b分之1= 2020-03-30 …
帮我解决一道初三数学题(很简单的化简题)是我太弱了.可以的话帮我解析下.(写出步骤)a-b2ab- 2020-04-27 …
2011年北京高考语文卷第2题A项中“不足为训”的用法对吗?附原题:2.下列句子中,加点的成语使用 2020-06-14 …
2011天津高考语文第2题A选项“协赛曲”是什么意思?怀疑是“协奏曲”的错别字2.下列词语中没有错 2020-06-17 …
日语作业谁能帮帮啊:第1题(2)分それはとても()问题です.A、たいせつなB、いろいろな第2题(2 2020-06-19 …
初一数学因式分解问题一共有三道题.会做几道是几道,希望大家帮帮忙1.用提公因式把9x的2m次方-3 2020-08-01 …
几道数学题不会帮帮忙!①:已知2x-3y+z=0,3x-2y-6z=0,xyz不等于0,求x^2+y 2020-11-07 …
大家帮帮忙啦!我有几题数学题要请教你们!解方程1.x^2-5x=02.(x+3)\(2x-4)=3\ 2020-12-07 …
大哥大姐帮帮忙,最好说下解题思路.好的我多加分第一题:若A<0,B<0且A的绝对值<B的绝对值,试确 2020-12-12 …
你帮我回答的化简函数很厉害,你还可以帮我化简几道题吗?用卡诺图法化简1题L=∑m(0,1,3,5,7 2020-12-23 …