91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2021-06-18
  • 語言: Java
  • 標簽: java??對象數組??

資源簡介

運用了java中對象數組的知識,導入代碼以后需要改動一下包名,適合初學者使用

資源截圖

代碼片段和文件信息

package?com.xmcc.interface1.homework2;

import?java.util.Scanner;

/**
?*?@author?張興林
?*?@date?2018-12-21?16:41
?*/
public?class?Manager?{
????static?int?number?=?0;
????public?Student[]?add(Student[]?student){
????????String?choise?=?null;
????????do?{
????????????Scanner?sc?=?new?Scanner(System.in);
????????????System.out.println(“請輸入要插入的學員信息“);
????????????System.out.print(“學號:“);
????????????int?Id?=?sc.nextInt();
????????????System.out.print(“姓名:“);
????????????String?Name?=?sc.next();
????????????System.out.println(“三門成績:“);
????????????System.out.print(“成績1:“);
????????????double?score1?=?sc.nextDouble();
????????????System.out.print(“成績2:“);
????????????double?score2?=?sc.nextDouble();
????????????System.out.print(“成績3:“);
????????????double?score3?=?sc.nextDouble();
????????????student[number]?=?new?Student();
????????????student[number].setId(Id);
????????????student[number].setName(Name);
????????????student[number].setPerformance1(score1);
????????????student[number].setPerformance2(score2);
????????????student[number].setPerformance3(score3);
????????????number++;
????????????System.out.println(“添加成功“);
????????????System.out.print(“是否要繼續插入新學員:y/n“);
????????????choise?=?sc.next();
????????????while?(!choise.equalsIgnoreCase(“y“)?&&?!choise.equalsIgnoreCase(“n“))?{
????????????????System.out.println(“輸入錯誤,請重新輸入!“);
????????????????choise?=?sc.next();
????????????}
????????}while?(choise.equalsIgnoreCase(“y“));
????????return?student;
????}

????public?Student[]?delete(Student[]?student){
????????Scanner?sc?=?new?Scanner(System.in);
????????String?str?=?null;
????????do?{
????????????System.out.println(“根據學號刪除請選擇1,根據姓名刪除請選擇2“);
????????????String?a?=?sc.next();
????????????switch?(a){
????????????????case?“1“:
????????????????????System.out.print(“請輸入需要刪除的學員學號:“);
????????????????????int?num?=?sc.nextInt();
????????????????????for?(int?i?=?0;?i?????????????????????????if?(student[i]?!=?null?&&?student[i].getId()?==?num){
????????????????????????????student[i]?=?null;
????????????????????????}
????????????????????}
????????????????????System.out.println(“刪除成功“);
????????????????????break;
????????????????case?“2“:
????????????????????System.out.print(“請輸入需要刪除的學員姓名:“);
????????????????????String?Name?=?sc.next();
????????????????????for?(int?i?=?0;?i?????????????????????????if?(student[i]?!=?null?&&?student[i].getName().equals(Name)){
????????????????????????????student[i]?=?null;
????????????????????????}
????????????????????}
????????????????????System.out.println(“刪除成功“);
????????????????????break;
????????????????default:
????????????????????System.out.println(“刪除失敗“);
????????????}
????????????System.out.println(“繼續刪除請選擇y/Y,放棄請輸入其他字符“);
????????????str?=?sc.next();
????????}while?(str.equalsIgnoreCase(“y“));
????????return?student;
????}

????public?Student[]?update(Student[]?student){
????????Scanner?sc?=?new?Scanner

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????9996??2018-12-25?16:59??homework2\Manager.java

?????文件???????1420??2018-12-25?10:48??homework2\Student.java

?????文件???????1892??2018-12-25?16:56??homework2\Test.java

?????目錄??????????0??2018-12-26?20:07??homework2

-----------?---------??----------?-----??----

????????????????13308????????????????????4


評論

共有 條評論