问答题

[说明]
本程序使用类来管理员工的通讯地址信息。已知程序的输出为:
输出记录:5
姓名:王丽华
街道地址:中华路15号
市:襄樊市
省:湖北省
邮政编码:430070
[Java代码]
public class Employee
protected String (1) ;
protected String street;
protected String city;
protected String prov;
protected String post;
protected int no;
public Empbyee()
public Employee(String name,String street,String city,String prov,String post, (2) )
this.name=name;
this.street=street;
this.city=city;
this.prov=prov;
this.post=post;
this.no=no;
public static void main(String[]args)
Employee emp=new Employee(“王华”,“中华路15号”,“武汉市”,“湖北省”,“430070”,1);
emp.changeName(“王丽华”);
(3) (“襄樊市”);
emp.changeNo(5);
(4) ;
void changeName(String name)this.name=name;
void changeStreet(String street)this.street=street;
void changeCity(String city)this.city=city;
void changeProv(String prov)this.prov=prov;
void changeNo(int no) (5) ;
void display()
System.out.println(“输出记录:”+this.no);
System.out.Println(“姓名:”+this.name);
System.out.println(“街道地址:”+this.street);
System.out.println(“市:”+this.city);
System.out.println(“省:”+this.prov);
System.out.println(“邮政编码:”+this.post);

【参考答案】

(1) name (2) int no (3) emp.changeCity (4) emp.display() (5......

(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)
热门 试题

问答题
[说明] 某公司的服务器上为每位员工提供了一定大小的存储空间,用于数据的备份。下面的程序面向公司员工,提供了本地计算机与服务器端之间文件传输的功能。主要操作介绍如下: (1)连接服务器:员工需要输入用户名和口令才能连接到服务器端,checkUser函数用于检查用户名和口令是否合法,返回真假值。 (2)上传文件:从本地计算机上传文件到服务器。员工可以在本地文件列表中选择一个或多个文件,这些文件通过上传操作被复制到服务器端指定的某个文件夹中; (3)下载文件:从服务器端下载文件到本地。 在开发过程中,本地驱动器列表框名为Drive1,本地和服务器端目录列表框分别名为Dir1和 Dir2,本地和服务器端文件列表框分别名为File1和File2,界面上有上至下四个按钮分别名为Command1至Command4。[Visual Basic代码]Private Sub Drive1_Change() (1) ’更新目录列表框的路径End SubPrivate Sub Dir1_Change() File1.Path=Dir1.Path ’更新文件列表框file1的路径End SubPrivate Sub Dir2_Change() File2.Path=Dir2.Path ’更新文件列表框file2的路径End Sub’连接服务器Private Sub Command1_Click() Dim user,password As String user= (2) (“请输入用户名:”) password= (2) (“请输入口令:”) If check User(user,password)Then ’若用户名和口令正确 Dir2.Path=…… ’打开服务器上某一指定目录 Else: MsgBox“口令错误,请重试!” End IfEnd Sub’上传文件Private Sub Command2_Click() Dim fso As new FileSystemObject,f As File,i As Integer If File1.FileName= Then ’判断是否已经选中文件 MsgBox“请选择本地的文件!” Exit Sub End If ’创建文件系统对象 Set fso=CreateObject(“Scripting.FileSystemObject”) ’上传文件For i=0 To (3) ’遍历文件列表框File1中的全体文件 If (4) Then’若该文件被选中 Set f=fso. (5) (Dir1.Path & “ ” & File1.List(i)) f.Copy Dir2.Path & “ ” & File1.List(i),True ’复制文件至服务器端 End If Next File2.RefreshEnd Sub’下载文件Private Sub Command3_Click() ……End Sub’退出程序Private Sub Command4_Click() EndEnd Sub