丁老师的作业,书上的代码

感觉书上的没有啥意义,就自己写了一个


可以满足的功能有,新建一个文件,(需要输入文件路径和文件名)

然后就是写入文字。

写入状态下输入off退出去。

代码如下

但是还有一个弱点    也就是  不能换行

import java.io.*;
import java.util.Scanner;
public class FileWr {
	public static void main(String arg[]) throws IOException{
		String dir =null;
		String FileName = null;
		Scanner sca = new Scanner(System.in);
		System.out.println("请输入路径");
		dir=sca.nextLine();
		System.out.println("请输入文件名");
		FileName=sca.nextLine();
		File f = new File(dir,FileName);
		FileOutputStream fileout = new FileOutputStream(f,true);
		byte []b = null;
		String text = null;
		System.out.println("请输入文件内容,输入off关闭");
		while(!(text=sca.nextLine()).equals("off"))
		{
			b=text.getBytes();
			fileout.write(b);
		}
		fileout.close();
		
		
	}

}


由于教师发布作业和批改作业的HTML代码需要根据具体情况而定,因此无法提供通用的HTML代码。不过,下面提供一个简单的示例代码,供参考: ``` <!DOCTYPE html> <html> <head> <title>作业提交与批改系统</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"> </head> <body> <header> <h1>作业提交与批改系统</h1> </header> <main> <h2>发布作业</h2> <form action="upload.php" method="post" enctype="multipart/form-data"> <label for="title">作业标题:</label> <input type="text" id="title" name="title" required><br> <label for="description">作业描述:</label> <textarea id="description" name="description" required></textarea><br> <label for="file">上传作业:</label> <input type="file" id="file" name="file" required><br> <button type="submit">发布作业</button> </form> <h2>批改作业</h2> <table> <thead> <tr> <th>作业标题</th> <th>学生姓名</th> <th>上传时间</th> <th>操作</th> </tr> </thead> <tbody> <tr> <td>作业1</td> <td>张三</td> <td>2021-01-01 10:00:00</td> <td> <a href="homework1.html">查看作业</a> <a href="score.php">评分</a> </td> </tr> <tr> <td>作业2</td> <td>李四</td> <td>2021-01-02 11:00:00</td> <td> <a href="homework2.html">查看作业</a> <a href="score.php">评分</a> </td> </tr> </tbody> </table> </main> <footer> <p>版权所有 © 2021</p> </footer> </body> </html> ``` 上述代码实现了一个简单的作业提交与批改系统的HTML界面,包括发布作业和批改作业两个功能。其中,发布作业部分包括一个表单,可以输入作业标题、作业描述和上传作业文件;批改作业部分包括一个表格,可以查看学生提交的作业信息,并提供查看作业和评分的功能。需要注意的是,代码中的上传作业和评分功能需要通过后端语言实现才能正常工作。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值