我需要使用Java启动来编写此代码的帮助. [英] I need help writing this in java launage.

查看:84
本文介绍了我需要使用Java启动来编写此代码的帮助.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个程序,提示用户输入两个数字然后指向.
总和
区别
该产品
平均
距离(差的绝对值)
最大(两个中的较大者)
最小值(两个中的较小者)

为此
实现一个类
公开课公平
{
构造一对.
@param aFirst这对的第一个值.
@param秒是该对的第二个值.

公共对(double aFirst,double aSecond){. . .}
/**
计算这对值的总和.
@返回第一个和第二个值的和
*/public double getSum(){. . .}
...
}

说明
PairTest.java程序应使用防弹输入来提示并从用户那里收集数字对的两个值,使用这些值创建数字对对象,显示初始值,并应输出计算出的7个列出的计算值.

额外抵免额选项:
在驱动程序(PairTest)中包含其他代码,该代码将创建一个具有两个介于0到10之间(含0和10)之间的随机double值的对.确保显示两个对值以及计算值. (换句话说,用户应该能够通过检查输出使用随机数来确认程序是正确的.)

Write a program that prompts the user for two numbers then points.
The sum
The difference
The product
the average
the distance (absolute value of the difference)
the maximum (the larger of the two)
the minimum (the smaller of the two)

To do so
implement a class
public class fair
{
Constructs a pair.
@param aFirst the first value of the pair.
@param Asecond the second value of the pair.

public Pair(double aFirst, double aSecond){. . .}
/**
Computes the sum of the values of this pair.
@return the sum of the first and second values
*/ public double getSum() {. . .}
...
}

INSTRUCTIONS
The PairTest.java program should use bullet proof input to prompt and collect the two values for the number pair from the user, create a number pair object using these values, display the initial values and should output the computed 7 listed computed values .

Extra Credit option:
include additional code in the driver (PairTest) that creates a pair with two random double values between 0 and 10 inclusive. Be sure to show the two pair values as well as the computed values. (In other words, the user should be able to confirm that the program is correct using the Random numbers by inspecting the output.)

推荐答案

这是 您的作业.如果您实际尝试自己做,则会学到更多.如果您遇到特定于 的问题,我们可以为您提供帮助,但我们不能为您解决这个问题.
This is your homework. You will learn a lot more if you actually try and do it yourself. We can help you if you get stuck with a specific problem but we are not here to do it for you.


这篇关于我需要使用Java启动来编写此代码的帮助.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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