提着裤子去拉屎 2022-07-14 11:34 采纳率: 77.8%
浏览 35
已结题

关于#Java#自学,方法定义,

我自己注释了类定义,在每个方法的空白区域内添加方法定义,用点表示,就像我前面注释所。

      { private String name; // the student’s full name
         private String id; // the student ID
         private int credits; // the amount of credits for study taken so far
 // Create a new student with a given name and ID number.
 public Student (String fullName, String studentID)
          { name = fullName;
            id = studentID;    
            credits = 0; }
 // Return the full name of this student.
   …………………………………………………..
 // Set a new name for this student.
    …………………………………………………..
 // Return the student ID of this student.
    ………………………………………………….
 // Add some credit points to the student’s accumulated credits.
                              ………………………………………………………………………

 /* Check the number of credit points this student has accumulated.
 * If it is less than 132, then print “Not yet graduated”, otherwise print “Graduated”.
 */     
    for (i=0; i<2; i++) { 
           System.out.print("Enter Marks of Subject"+(i+1)+":");
           marks[i] = scanner.nextInt();
           total = total + marks[i];   }
        scanner.close();

   ……………………………………………………………………       

      
      // Print the student’s name and ID number to the output terminal.
     ………………………………………………………

```……………..

  • 写回答

3条回答 默认 最新

  • it_hao528 2022-07-14 13:47
    关注

    这看着就是个学生类,有名字 学号 学分 三个字段,一个构造方法包括名字和学号且学分初始为0,注释的...的部分是要补充还是什么?下边的for循环没看出来有什么用,写法是是需要写在方法里边的。你这个主要想问的问题是什么?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 7月14日
  • 已采纳回答 7月14日
  • 创建了问题 7月14日

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。