售卖电影票的java代码 电影购票系统javaee代码( 二 )


//StudentXW的构造函数
public StudentXW(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
super(studentNo,studentName,englishSocre,computerScore,mathScore);
}
}
//Student子类班长类的实现
class StudentBZ extends Student {
//重写父类Student的testScore()方法
@Override
public double testScore() {
return sum()/3+5;
}
public StudentBZ() {}
//StudentXW的构造函数
public StudentBZ(String studentNo,String studentName,double englishSocre,double computerScore,double mathScore) {
super(studentNo,studentName,englishSocre,computerScore,mathScore);
}
}
//测试类
public class Test {
public static void main(String[] args) {
//生成若干个student类、StudentXW类、StudentBZ类
Student student1 = new Student("s001","张三",70.5,50,88.5);
Student student2 = new Student("s002","李四",88,65,88.5);
Student student3 = new Student("s003","王五",67,77,90);
StudentXW student4 = new StudentXW("s004","李六",99,88,99.5);
StudentBZ student5 = new StudentBZ("s005","朱漆",56,65.6,43.5);
Student[] students = {student1,student2,student3,student4,student5};
for(int i = 0 ; istudents.length; i++){
double avgScore = students[i].testScore();
System.out.println(students[i].getStudentName()+"学生的评测成绩为:"+ avgScore+"分");
}
}
}
运行结果为:
张三学生的评测成绩为:69.66666666666667分
李四学生的评测成绩为:80.5分
王五学生的评测成绩为:78.0分
李六学生的评测成绩为:98.5分
朱漆学生的评测成绩为:60.03333333333333分
电影院售票的求大虾们帮我做一个电影院售票系统(C#,java都行)CS或者BS结构都行,很急 请大虾们帮帮忙这是我以前写售卖电影票的java代码的
#includestdio.h
#includestring.h
#define N 99 //票数容量
struct Date
{
int year;
int month;
int day;
};
struct Word
{
char movie[20]; //片名
struct Date time; //上映日期
int price; //票价
int spare; //剩余票数
}a[N],t;
void newticket(FILE *fp)
{
printf("片名售卖电影票的java代码:");
scanf(" %s",t.movie);
printf("日期:(例如 2014 1 25)\n");
scanf("%d%d%d",t.time.year,t.time.month,t.time.day);
printf("票价:");
scanf(" %d",t.price);
printf("剩余票数:");
scanf(" %d",t.spare);
if(t.spare!=0) //余票不为0
fprintf(fp,"%-20s %4d-%02d-%02d %3d %3d\n",t.movie,t.time.year,\
t.time.month,t.time.day,t.price,t.spare);
fclose(fp);
}
void look(FILE *fp)
{
int i,n=0;
// char ch;
fclose(fp);
fp=fopen("电影票.txt","r");
for(i=0;iN;i++)
{
fscanf(fp,"%s %d-%d-%d %d %d\n",a[i].movie,a[i].time.year,\
a[i].time.month,a[i].time.day,a[i].price,a[i].spare);
if(a[i].spare0)n++;
}
for(i=0;in;i++)
printf("%-20s %4d-%02d-%02d %3d %3d\n",a[i].movie,a[i].time.year,\
a[i].time.month,a[i].time.day,a[i].price,a[i].spare);
fclose(fp);
}
void menu()
{
printf("========电影票管理系统========\n");
printf("1.添加售票2.余票查询\n0.退出程序\n");
printf("==============================\n");
printf("功能选项:");
}
int main()
{
FILE *fp;
char c;
while(1)
{
menu();
scanf(" %c",c);
fp=fopen("电影票.txt","a+");
switch(c)
{
case '1':newticket(fp);break;
case '2':look(fp);break;
case '0':return 0;
}
}
}
利用java,如何锁定数组中的一个值,例如 , 购买电影票选座位,如何用java实现这段代码逻辑不清楚

推荐阅读