问卷调查代码java 问卷调查代码html

JAVA设计一个Applet,完成一份调查问卷 , 至少包括五个题目,import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
【问卷调查代码java 问卷调查代码html】import java.awt.Graphics;
public class DrawString extends Applet {
public void paint(Graphics g)
{
g.setFont(new Font("宋体",Font.BOLD,36));
g.setColor(Color.green);
g.drawString("这是一个Java Applet程序",5,30);
g.setColor(Color.red);
g.drawString("欢迎学习Java",5,80);
}
}
java代码求大大华为就爱出这些题,都是C或者C++的人出的,看输入输出就看出来了.
排序和去重,我都是放到deleteChong里面实现的,你自己整理下
public static int[] deleteChong(int[] a) {
// 排序
for (int i = 0; ia.length; i++) {
for (int j = i + 1; ja.length; j++) {
if (a[i]a[j]) {
continue;
}
int tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
}
System.out.println(Arrays.toString(a));
// 去重
boolean[] b = new boolean[a.length];
int oldVal = a[0];
int count = 0;
for (int i = 1; ia.length; i++) {
if (oldVal == a[i]) {
b[i] = true;
count++;
} else {
oldVal = a[i];
}
}
int idx = 0;
int[] result = new int[a.length - count];
for (int i = 0; ia.length; i++) {
if (b[i]) {
continue;
}
result[idx++] = a[i];
}
return result;
}
怎么用Java程序编写个调查问卷1------------------------------------------------------------------------------
import java.util.Scanner;
public class Main{
public static void main(String[] args) throws IOException{
Scanner scan = new Scanner(System.in);
System.out.println("输入一个整数:");
int num = scan.nextInt();
char[] numChar = Integer.toString(num).toCharArray();
for(int i = 0;inumChar.length; i++) {
System.out.println(numChar[i]);
}
}
}
2-----------------------------------------------------
public class Text2 {
public static void main(String[] args) {
int j = 0, k = 0;
for (int i = 1 ; i = 100; i++) {
if (i % 2 == 0) {
j += i ;
} else {
k += i;
}
}
System.out.println("偶数和为:" + j);
System.out.println("奇数和为:" + k);
}
}
3------------------------------------------------------------------------
import java.util.*;
public class Test {
public static void main(String[] args) {
Scanner san = new Scanner(System.in);
int aint = 0;
System.out.print("请输入一个整数: ");
aint = san.nextInt();
System.out.println(aint + "的二进制表示为: " + Integer.toBinaryString(aint));
}
}
4--------------------------------------------------------------------------------
public class text {
public static void main(String args[]) {
text t = new text();
System.out.print(t.sum());
}
public int sum(){
int a = 0;
for(int i=1;i=10;i++){
int b = 1;
for (int j = 1; j =i; j++) {
b = b*j;
}
a=a+b;
}
return a;
}
}
4.2----------------------------------------------------------
import java.io.*;
public class jiecheng
{
public static long fac(int n)
{long res=1;
for(int k=2;k=n;k++)
res*=k;
return res;}
public static void main(String args[]) throws IOException
{long sum=0;int i=1,n=20;
for(i=1;i=n;i++)
sum+=fac(i);
System.out.println("前"+n+"项阶乘的为:"+sum);
}
}
5--------------------------------------------------------------------------
public class Dy3 {
public static void main(String[] args) {

推荐阅读