Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <script>
- var isNorm=true;
- var date=new Date();
- class User {
- constructor(name, surname) {
- this.name = name;
- this.surname = surname;
- }
- getInfo() {
- if(this.isNorm)
- return this.name + ' ' + this.surname;
- else
- return "Студент не числится"
- }
- }
- class Student extends User{
- constructor(name, surname,year=date.getFullYear()) {
- super(name,surname);
- this.year=year;
- this.isNorm = arguments.length !== 2;
- }
- enroll() {
- if (!this.isNorm){
- this.isNorm=true;
- }else
- throw "Уже зачислен";
- }
- expel(){
- this.isNorm=false;
- }
- GetCurse() {
- var a =date.getFullYear(parseInt())-this.year;
- if(this.isNorm&&a<=6)
- return a+1;
- else
- return "Студент не числится"
- }
- getInfo() {
- if(this.isNorm)
- return this.name + ' ' + this.surname+ ' Студент '+this.GetCurse()+" курса";
- else
- return "Студент не числится"
- }
- }
- var student = new Student("Жека","Ахмедов");
- console.log(student.getInfo());
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement