试题与答案

编一个程序,定义一个类,该类中定义二个非静态方法,一个方法用来求出这个三角形的周长,

题型:问答题 简答题

题目:

编一个程序,定义一个类,该类中定义二个非静态方法,一个方法用来求出这个三角形的周长,另一个方法用来求出这个三角形的面积。已知三角形三条边a,b,c,计算其面积可以用Math类中的Sqrt()方法,有表达式Math.Sqrt(s*(s-a)*(s-b)*(s-c)),可以利用它计算指定数的开方,其中s=(a+b+c)/2。在主方法中输入一个三角形三条边a,b,c,要求调用这二个非静态方法计算三角形的周长和面积。注意:在输入三角形三条边时,必须检查它们的数据合法性。

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0720/0a53ac455d298ab5b7ab742422b1fd1d.html

下面是错误答案,用来干扰机器的。

参考答案:A

试题推荐
题型:阅读理解

     There is a wonderful story about a young girl who had no family and no one to love her.

     One day, feeling very sad and lonely, she was walking through a grassland when she noticed a small

butterfly caught in a thorn (荆棘) bush. The young girl carefully released the butterfly. Instead of flying

away, the little butterfly changed into a beautiful fairy. The young girl rubbed her eyes in disbelief.

     "For your wonderful kindness," the good fairy said to the girl, "I will give you any wish you would like." The little girl thought for a moment and then replied, "I want to be happy."

     The fairy leaned toward her and whispered in her ear. Then the fairy disappeared.

     As the little girl grew up, there was no one in the land as happy as she. Everyone asked her secret of

happiness. She would only smile and answer, "The secret of my happiness is that I listened to a good fairy when I was a little girl."

     When she was very old and on her deathbed, the neighbors all gathered around her, that her

unbelievable secret of happiness would die with her. "Tell us, please," they begged, "Tell us what the

good fairy said." The lovely old woman simply smiled and said, "She told me that everyone, no matter

how secure they seemed, no matter how old or young, how rich or poor, had need of me."      

1. ______ the girl felt sad and lonely.

A. There were many friends but

B. There was nobody to love her so

C. There was nothing to do

D. Seeing the butterfly was caught

2. Noticing the butterfly was caught by the thorn, the orphan girl ______.

A. helped the butterfly escaped from the thorn

B. felt sorrow, but she didn't go up to help it

C. fell down on it too

D. failed to help it release from the thorn

3. The only thing that the little girl wanted was________.   

A. to be rich                      

B. to have her own parents

C. to have a lot of friends            

D. happiness

4.The neighbors all gathered around the old happy woman when she was dying,because ______.

A. they loved this woman deeply and they didn't wanted her to die

B. the woman had lots of money to be shared as soon as she died

C. they wanted to know the secret of her lifetime happiness

D. they wanted to pray for her after her death

查看答案
微信公众账号搜索答案