那位老大帮帮我做作这些问题?????

来源:百度知道 编辑:UC知道 时间:2024/05/09 18:40:17
Java Programming 1: LAB 4

Note: You have to show the answers to the tutor during the lab hours. The tutor will assess anyour answers d mark will be awarded to those students who finish this exercise.

Objectives:
• To be able to display message/ get input by using JOptionPane class
• To be able to use arithmetic operators.
• To understand the precedence of arithmetic operators.

Question 1:

// Example which display text using dialog box
import javax.swing.JOptionPane;
class LabExerciseGUI
{
public static void main(String[ ] args)
{
JOptionPane.showMessageDialog(null,
"Jennifer \n 1000123456 \n 1980 \n\n Good Luck");
System.exit(0);
} // end main
} // end class

Program 1

Copy the above LabExerciseGUI class. Modify the it with your own name, your ID number, Date of

抱歉,只能用C++来解决你的第二个问题,

#include <iostream>
using namespace std;

int main(){
int a,b,c,sum,multiplication,average;
cout<<"Input a:";
cin>>a;

cout<<"Input b:";
cin>>b;

cout<<"Input c:";
cin>>c;

sum=a+b+c;
multiplication=a*b*c;
average=sum/3;

cout<<"The sum is "<<sum
<<",the multiplication is "
<<multiplication<<endl;
<<"and the average is "<<average;

return 0;
}

上面的代码没有经过调试,你可以试一下,
我不会JAVA,但是C++和JAVA很像,相信你有能力将其
转换成JAVA代码。

另外,你说的那个screen shot in page 2. 并没有给出,因此我没有办法做到像你所说第二页中的那个截图完全相同。还是很抱歉其他两题我也不会。。