求“JavaSprict程序设计”作业
纯手打,很辛苦的,望采纳,^_^
创新互联是专业的京口网站建设公司,京口接单;提供成都做网站、成都网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行京口网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
完事,睡觉,有问题追问吧
1. 新建第1个页面:
html
head
title实验六: 表单/title
/head
body
form name="form1" action="B.html"
divh4实验六: 表单/h4/div
div style="font-size:12px;"
div style="font-weight:bold;margin-bottom:20px;"请输入您的基本信息(必须填写)/div
div style="height:25px;"span style="margin-right:15px;"您的姓名:/spaninput type="text" name="userName" style="width:250px;height:20px;" //div
div style="height:25px;"span style="margin-right:15px;"您的性别:/spaninput type="radio" name="sex" value="1" checked="checked" /男性 input type="radio" name="sex" value="2" /女性/div
div style="height:25px;"span style="margin-right:15px;"您的年龄:/spaninput type="text" name="bir" style="width:250px;height:20px;" //div
div style="height:25px;"span style="margin-right:15px;"所在单位:/spaninput type="text" name="unit" style="width:250px;height:20px;" //div
div style="height:25px;"span style="margin-right:15px;"电话号码:/spaninput type="text" name="tele" style="width:250px;height:20px;" //div
div style="font-weight:bold;margin:20px 0px;"请输入您的其他信息(选择填写)/div
div style="height:25px;"span style="margin-right:15px;"您向往的职业:/spanselect name="work"option value="1"教师/optionoption value="2"医生/optionoption value="3"程序猿/option/select/div
div style="height:25px;"span style="margin-right:15px;"您喜欢的运动/spaninput type="checkbox" name="sp1" value="1" /足球 input type="checkbox" name="sp2" value="2" /篮球 input type="checkbox" name="sp3" value="3" /排球 input type="checkbox" name="sp4" value="4" /羽毛球 input type="checkbox" name="sp5" value="5" /乒乓球/div
div style="height:110px;"span style="margin-right:15px;"请给我留言:/spantextarea name="re" style="width:240px;height:100px;"/textarea/div
div style="height:25px;"span style="margin-right:15px;"单击该按钮显示提交的个人信息:/spanbutton name="cmd"确定/button/div
/div
/form
/body
/html
2. 新建第2个页面:
html
head
title实验六: 表单/title
script
window.onload = function(){
document.getElementById("userName").innerText = getQuery("userName");
var sex = "";
if(getQuery("sex") == "1")
sex = "男";
else if(getQuery("sex") == "2")
sex = "女";
document.getElementById("sex").innerText = sex;
document.getElementById("bir").innerText = getQuery("bir");
document.getElementById("unit").innerText = getQuery("unit");
document.getElementById("tele").innerText = getQuery("tele");
var sex = "";
if(getQuery("work") == "1")
sex = "教师";
else if(getQuery("work") == "2")
sex = "医生";
else if(getQuery("work") == "3")
sex = "程序猿";
var sp = "";
if(getQuery("sp1") == "1")
sp += "足球,";
if(getQuery("sp2") == "2")
sp += "篮球,";
if(getQuery("sp3") == "3")
sp += "排球,";
if(getQuery("sp4") == "4")
sp += "羽毛球,";
if(getQuery("sp5") == "5")
sp += "乒乓球,";
if(sp.length 0)
sp = sp.substring(0, sp.length - 1);
document.getElementById("sp").innerText = sp;
document.getElementById("re").innerText = getQuery("re");
};
function getQuery(name) {
var reg = new RegExp("(^|)" + name + "=([^]*)(|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
}
/script
/head
body
divh4实验六: 表单/h4/div
div style="font-size:12px;"
div style="font-weight:bold;margin-bottom:20px;"请输入您的基本信息(必须填写)/div
div style="height:25px;"span style="margin-right:15px;"您的姓名:/spanspan id="userName"/span/div
div style="height:25px;"span style="margin-right:15px;"您的性别:/spanspan id="sex"/span/div
div style="height:25px;"span style="margin-right:15px;"您的年龄:/spanspan id="bir"/span/div
div style="height:25px;"span style="margin-right:15px;"所在单位:/spanspan id="unit"/span/div
div style="height:25px;"span style="margin-right:15px;"电话号码:/spanspan id="tele"/span/div
div style="font-weight:bold;margin:20px 0px;"请输入您的其他信息(选择填写)/div
div style="height:25px;"span style="margin-right:15px;"您向往的职业:/spanspan id="work"/span/div
div style="height:25px;"span style="margin-right:15px;"您喜欢的运动/spanspan id="sp"/span/div
div style="height:110px;"span style="margin-right:15px;"请给我留言:/spanp id="re"/p/div
/div
/body
/html
10个人排成圈,然后报数,报到7的人出列,然后从第八个人再开始报一,,,,,循环。求java代码!
public class Josephus{
public static void main(String[] args) {
mAndN(7,10);
}
public static void mAndN(int m, int n) {
CircleList cl = new CircleList(n);
cl.showSequence(m);
}
}
class CircleList{
Node head;
CircleList(int n){
head = new Node(1);
Node tail = head;
Node temp;
for(int i = 2;i = n;i++){
temp = new Node(i);
tail.setNext(temp);
tail = temp;
}
tail.setNext(head);
}
public void showSequence(int m) {
Node temp = head;
System.out.println("The sequence of getting out:");
while(head != head.getNext()){
for(int i = 0;i m;i++)
temp = temp.getNext();
System.out.print(temp.getNumber() + " ");
remove(temp);
head = temp;
}
System.out.println(head.getNumber());
}
public void remove(Node n){
n.setNumber(n.getNext().getNumber());
n.setNext(n.getNext().getNext());
}
}
class Node{
private int i;
private Node next;
Node(int i){
this.i = i;
}
public void setNumber(int i){
this.i = i;
}
public void setNext(Node next){
this.next = next;
}
public int getNumber(){
return i;
}
public Node getNext(){
return next;
}
}
输出:
The sequence of getting out:
8 6 5 7 10 3 2 9 4 1
求一个Java程序:学校进行体能考核,在全部六个项目中每个学生随机抽取两个项目(不重复)进行考核,
应该满足你的要求了.myEclipse 9.0环境测试成功.如果可以用,请给分咯~
够简单了吧,实体类都没用.
public static void main(String[] args) {
String[] sports = { "篮球", "足球", "排球", "羽毛球", "兵乓球", "网球" };
Scanner s = new Scanner(System.in);
String answer = "y";
while (answer.equals("y")) {
String[] chosed = randomS(sports);
System.out.println("指派某个学生的测试项目为:" + chosed[0] +"和" + chosed[1]);
System.out.println("要继续吗?(y/n)");
answer = s.nextLine();
}
}
private static String[] randomS(String[] sports) {
String[] chosed = new String[2];
int i = -1;
i = (int) (Math.random() * 6);
chosed[0] = sports[i];
while (true) {
i = (int) (Math.random() * 6);
if (sports[i].equals(chosed[0])) {
continue;
} else {
chosed[1] = sports[i];
break;
}
}
return chosed;
}
文章名称:java排球出场的代码 java排球出场的代码是什么
URL地址:http://scyingshan.cn/article/hhpogg.html