java编程:类A能计算2个正整数的最大公约数,类B能计算2个正整数的最小公倍数, 求错误,不会改,谢谢!

//类B中有一个成员变量是用类A的声明对象classA//计算2个正整数的最大公约数{intmax=0;publicintbig(intx,inty){if(x=y){m... //类B中有一个成员变量是用类A的声明对象

class A //计算2个正整数的最大公约数
{
int max=0;
public int big(int x,int y)
{
if(x=y)
{
max=x;//如果2个数相等,则最大公约数为他们本身
}
else if(x<y) //如果2个数不相等,则用2个数依次除以从1开始一直到2个数中较小的那个数来判断他们的最大公约数
{
for(int i=1;i<=x;i++)
{
if(x%i==0&&y%i==0)
{
max=i;
}
}
}
else
{
for(int i=1;i<=y;i++)
{
if(y%i==0&&x%i==0)
{
max=i;
}
}
}
return max;
}
}
class B //计算2个正整数的最小公倍数
{
int min=0;
public int small(int x,int y)
{
if(x=y)
{
min=x;//如果2个数相等,则最小公倍数为他们本身
}
else if(x<y)//如果2个数不相等,则从较大的那个数开始一直到这2个数的乘积除以这2个数,直到出现能同时整除这2个数的数,结束循环
{
for(int i=y;i<=x*y;i++)
{
if(i%y==0&&i%x==0)
{
min=i;
}
break;
}
}
else
{
for(int i=x;i<=x*y;i++)
{
if(i%x==0&&i%y==0)
{
min=i;
}
break;
}
}
return min;
}
}
public class P78_4
{
public static void main(String args[])
{
A a=new A();
System.out.println("最大公约数为:"+a.big(6,9));
B b=new B();
System.out.println("最小公倍数为:"+b.small(6,9));
}
}
展开
 我来答
airmaxshoppe
2011-04-16 · TA获得超过399个赞
知道答主
回答量:459
采纳率:0%
帮助的人:105万
展开全部
9. A typical application of the optimization program

In addition to the above listed improvements, Microsoft also turned to some specific applications, including search, browse without networking and small game. Here is where DVD player part of the optimization program:

These are the power management win7 9 in important improvements, compared to the previous system can save more power. In addition to these improvements, IT professionals can also be diagnosed with power management that may affect the power efficiency to find the problem.

When a computer starts,shoes nike air max, not always running at full capacity, so there will be a lot of free time, so the idle time power consumption becomes an important power management technology. In win7,discount nike air max shoes, the idle power consumption has been effectively improved, when a hardware is not working after a certain time will enter a low power state has power saving purposes. Including the CPU, hard drive, memory and network elements have adopted this technology. For example, a full-power operation of the CPU power consumption 35w power consumption during idle time is almost 0, only this one will be able to save a lot of power.

Intelligent data caching can reduce the drive speed

2. Through the trigger to start the service

7. Bluetooth devices to improve power

1. Idle power consumption of resources

The current processor instruction through the use of the gap processing time to spare to save energy, but most energy-saving technologies require a certain length of idle time to get energy-saving effect. And this technology by making the Windows kernel to terminate at the same time and focus more dispersed than the original timer, disposed of in a short time, thus increasing the processor's idle time.

System services are typically when the system starts with the start, and then resides in the background waiting to call. In windows 7, the service is only part of the system until triggered by some event started, such as inserting a device or change the IP. This background process can reduce the number of services in the long run.

win7 will support low-power Intel HD Audio specification, it allows codec into low power state. win7 also supports selective suspend technology, the device is turned off at idle, such as microphones and cameras such USB devices.

6. Timer integrated

3. Increased processor power management

Does not affect the playback performance in the premise of maintaining low power mode to CPU

Microsoft said the time is usually 10-15 minutes if no operation, the display will automatically shut down. However, in practice there will be more short-term use of non-operating condition, in order to better energy efficiency, the technology will reduce the display brightness. In addition, it could use some sensing devices to adjust the brightness according to ambient brightness of the display.

5. Low Power Audio

In addition, when the laptop in case of battery, win7 daemon will reduce the activities of non-critical frequency.

win7 in the integration of the latest power management technology,nike air max TN, which allows Windows 7 based on the current load conditions and performance requirements to dynamically adjust the CPU performance.

win7 in the radio network controller for low-power mode compatibility has been enhanced, and only in the wireless AP devices support the case of low-power mode will be enabled. Vista because it can not detect in advance whether to support low-power mode, the wireless network connection will lead to a sudden interruption. win7 will prevent this from happening, before entering the low power mode will first detect whether the wireless AP to support the model.

By changing the structure to improve the desktop window manager and GPU power consumption

When win7 Bluetooth device is detected in a low power state when they will be temporarily closed, the "selective suspend."

8. Network equipment to improve power

4. Adaptive display brightness adjustment
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
nba5632555
2011-04-22 · TA获得超过139个赞
知道答主
回答量:74
采纳率:0%
帮助的人:69.6万
展开全部
你把等于号和赋值好弄乱了,if(x=y)这里出错,这是赋值,不是比较,改成x==y试试看
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2011-04-20
展开全部
t java.util.*;

class Main
{
public static int gcd(int m,int n) {
while (true) {
if ((m = m % n) == 0) return n;
if ((n = n % m) == 0) return m;
}
}
public static void main(String args[]) throws Exception
{
Scanner cin=new Scanner(System.in);
int a=cin.nextInt(),b=cin.nextInt();
int c = gcd(a,b);
System.out.println("最小公倍数:" + a * b / c + "\n最大公约数:" + c);
}
}
另外,团IDC网上有许多产品团购,便宜有口碑
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式