推荐使用专业的问卷调查平台,通太问卷调查就可以,使用JAVA编写的。
成都创新互联是一家专业提供白城企业网站建设,专注与成都做网站、成都网站建设、html5、小程序制作等业务。10年已为白城众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
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);
}
}
NewPhone类
package com.baidu.question;
public class NewPhone extends Phone {
private boolean mute = true;
@Override
public void call() {
if(mute){
super.call();
}else{
System.out.println("语音已关闭");
}
}
//这里是直接设置
public void setMute(boolean mute){
this.mute=mute;
}
//担心你的题目是要求两种方法,写的第二种,下面两个方法负责开关
public void openMute(){
this.mute=true;
/*
* 也可以这样写
* setMute(true);
* 下边的方法一样
* */
}
public void closeMute(){
this.mute = false;
}
}
Phone类
package com.baidu.question;
public class Phone {
public void call(){
System.out.println("打电话");
}
}
测试类
package com.baidu.question;
public class PhoneTest {
public static void main(String[] args) {
Phone phone = new Phone();
phone.call();
NewPhone newPhone = new NewPhone();
newPhone.call();
newPhone.setMute(false);
newPhone.call();
newPhone.openMute();
newPhone.call();
newPhone.closeMute();
newPhone.call();
}
}
测试结果
打电话
打电话
语音已关闭
打电话
语音已关闭
你的意思是不是在下一页得到name的值.
如果是的话
可以
session.setAttribute("radioName",id)
然后在下一页
String radioName=(String)session.getAttribute("radioName");
不过感觉你的循环有问题,一题只有一个选项.
下面是一个存储班级三十名学生基本信息的 Java 代码示例:
import java.util.ArrayList;
public class Student {
private String name;
private int age;
private String gender;
public Student(String name, int age, String gender) {
this.name = name;
this.age = age;
this.gender = gender;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
public String getGender() {
return gender;
}
}
public class Classroom {
private ArrayListStudent students;
public Classroom() {
this.students = new ArrayListStudent();
}
public void addStudent(Student student) {
students.add(student);
}
public ArrayListStudent getStudents() {
return students;
}
}
public class Main {
public static void main(String[] args) {
Classroom classroom = new Classroom();
// 添加 30 名学生的基本信息
classroom.addStudent(new Student("Tom", 18, "Male"));
classroom.addStudent(new Student("Alice", 19, "Female"));
// ...
// 此处省略 28 名学生的信息
// 获取所有学生的信息
ArrayListStudent students = classroom.getStudents();
for (Student student : students) {
System.out.println("Name: " + student.getName());
System.out.println("Age: " + student.getAge());
System.out.println("Gender: " + student.getGender());
}
}
}
该代码定义了两个类:Student 类表示一个学生,包含了学生的姓名、年龄和性别等信息;Classroom 类表示一个班级,包含了一个学生的列表,并提供了添加学生和获取学生列表的方法。
在 Main 类的 main 方法中,我们首先实例化一个 Classroom 对象,然后依次添加 30 名学生的信息。最后,我们调用 getStudents 方法获取所
import java.util.Scanner;
/**
* @Author: Cool_Wu
* @Date: 2020-12-07 19:03
*/
public class Transport {
private static final int BOX_A = 1;
private static final int BOX_B = 3;
private static int count_A;
private static int count_B;
public static void main(String[] args) {
System.out.println("请输入宝物数量:");
int count = new Scanner(System.in).nextInt();
if (count 1 || count 50){
System.out.println("宝物数量输入有误!");
return;
}
for (count_B = 0; count_B = count / BOX_B; count_B++){
count_A = count - count_B * BOX_B;
System.out.println("盒子A装运宝物数量:" + BOX_A + "x" + count_A + "=" + BOX_A * count_A);
System.out.println("盒子B装运宝物数量:" + BOX_B + "x" + count_B + "=" + BOX_B * count_B);
System.out.println("宝物装运总数:" + BOX_A * count_A + "+" + BOX_B * count_B + "=" + (BOX_A * count_A + BOX_B * count_B));
System.out.println("-------------------------");
}
System.out.println("装运方案数为:" + count_B);
}
}
运行结果