帮助尝试弄清楚如何在Java Eclipse上创建两个类 [英] Help trying to figure out how to create two classes on Java Eclipse

查看:267
本文介绍了帮助尝试弄清楚如何在Java Eclipse上创建两个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个程序,该程序打印数字(基数)的幂(指数).实现一个类 PowerGenerator ,然后提供 Tester ,询问用户多少次生成幂(指数).在下面的示例中,用户输入2作为底数,输入4作为指数.假设指数从1开始,并假设两个数字都是整数.

输入基数:2 [输入]
输入最大指数:4 [输入]
2.0
4.0
8.0
16.0

必须使用while循环.

我不知道该如何设置PowerGenerator类.有人可以帮我弄清楚如何设置它以及如何格式化while循环吗?我必须使用Java Eclipse作为编译器.我是大一新生(请不要粗鲁),而且我对代码不是很熟悉.请帮助我.

Write a program that prints the powers (exponent) of a number (base). Implement a class PowerGenerator, and then supply Tester that asks a user how many times to generate the powers (exponent). In the following example, a user enters 2 for the base and 4 for the exponent. Assume that the exponent starts from 1 and assume both numbers are integers.

Enter the base number: 2 [enter]
Enter the maximum exponent: 4 [enter]
2.0
4.0
8.0
16.0

Must use a while loop.

I can''t figure out how I should set up the PowerGenerator class. Can someone please help me figure out how to set it up and how to format the while loop? I have to use Java Eclipse as my compiler. I''m a freshman college student (please don''t be rude) and i''m not very familiar with code. Please, help me.

推荐答案

由于这是一次大学作业,您可以向您的导师寻求帮助,或阅读 ^ ]来熟悉该语言.
As this is a college assignment you could ask your tutor for some assistance, or read the Java Tutorials[^] to get familiar with the language.


这篇关于帮助尝试弄清楚如何在Java Eclipse上创建两个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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