Entrance Exam and generator Mode

Source: Internet
Author: User
Maybe the concept is incorrect? When I go back to read books in the evening, you are also welcome to help me :) using system;
Using system. Collections. Generic;
Using system. text;

Namespace generator Mode
{
Class Program
{
Static void main (string [] ARGs)
{
Try
{
// You must study for further studies
Students A = new ();
// Of course, you must pass the examination
New Test (Children );

Kid A. Successful ();
}
Catch (exception ex)
{
Console. writeline (ex. Message );
}

Console. Read ();
}
}

Interface for further studies
{
Double Language score
{Get; set ;}
Double mathematical score
{Get; set ;}
Double Foreign Language score
{Get; set ;}

Void ();
}

Class learning: Further Studies
{
Double Language = 0;
Double mathematics = 0;
Double Foreign Language = 0;

Public double Chinese score
{
Get
{
Return language;
}
Set
{
Language = value;
}
}

Public double mathematical score
{
Get
{
Return mathematics;
}
Set
{
Mathematics = value;
}
}

Public double foreign language score
{
Get
{
Return foreign language;
}
Set
{
Foreign Language = value;
}
}

Public void ()
{
If (Language <60)
{
Throw new exception ("fail in Chinese, do not want to go to school ");
}

If (Mathematics <60)
{
Throw new exception ("fail in mathematics, don't want to go to school ");
}

If (Foreign Language <60)
{
Throw new exception ("Foreign Language failed, don't want to go to school ");
}

Console. writeline ("I finally succeeded ");
}
}

Class Test
{
Daily Study;

Private exam ()
{}

Public exam (daily study)
{
This. Daily learning = daily learning;
Final Exam ();
}

Void final exam ()
{
Random RD = new random ();
Study every day. Mathematical score = (double) RD. Next (1,100 );
Study every day. Foreign Language score = (double) RD. Next (1,100 );
Daily study. Chinese score = (double) RD. Next (1,100 );
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.