Oop assignment 2

Source: Internet
Author: User

Package com. Infosys. onon_liu02.test;

Public class demo {
Public static void main (string [] ARGs ){
Student = new student ();
Student. setstudentid (1001 );
Student. setqualifyingexammarks (95.0f );
Student. setresidentialstatus ('D ');
Student. setyearofengg (2 );
If (student. validateexammarks ()){
System. Out. println ("valid marks ");
}
Else
System. Out. println ("invalid marks, the range of the qualifying exam marks is between 65 and 100 ");
System. Out. println ("student ID:" + student. getstudentid ());
System. Out. println ("qualifying marks:" + student. getqualifyingexammarks ());
System. Out. println ("qualifying marks:" + student. getresidentialstatus ());
System. Out. println ("current year of Engineering:" + student. getyearofengg ());
Registration Reg = new registration ();
Reg. setregistrationid (1001 );
System. Out. println ("registration ID:" +
Reg. getregistrationid ());

}

}

Package com. Infosys. onon_liu02.test;

Public class student {
Private int studentid;
Private float qualifyingexammarks;
Private char residentialstatus;
Private int yearofengg;
Public int getstudentid (){
Return studentid;
}
Public void setstudentid (INT studentid ){
This. studentid = studentid;
}
Public float getqualifyingexammarks (){
Return qualifyingexammarks;
}
Public void setqualifyingexammarks (float qualifyingexammarks ){
This. qualifyingexammarks = qualifyingexammarks;
}
Public char getresidentialstatus (){
Return residentialstatus;
}
Public void setresidentialstatus (char residentialstatus ){
This. residentialstatus = residentialstatus;
}
Public int getyearofengg (){
Return yearofengg;
}
Public void setyearofengg (INT yearofengg ){
This. yearofengg = yearofengg;
}
Public Boolean validateexammarks (){
If (qualifyingexammarks> = 65 & qualifyingexammarks <= 100 ){
Return true;
}
Else
Return false;
}
}

Package com. Infosys. onon_liu02.test;

Public class registration {
Private int registrationid;
Private double fees;
Public int getregistrationid (){
Return registrationid;
}
Public void setregistrationid (INT registrationid ){
This. registrationid = registrationid;
}
Public double getfees (){
Return fees;
}
Public void setfees (double fees ){
This. Fees = fees;
}
Public double calculateks (INT rangeofmarks ){
// Student = new student ();
// If (student. validateexammarks ()){
Int discount;
If (rangeofmarks> = 85 & rangeofmarks <= 100 ){
Discount = 12;
}
Else if (rangeofmarks >=75 & rangeofmarks <= 84 ){
Discount = 7;
}
Else {
Discount = 0;
}
Fees = fees-(fees * (double) discount/100 ));
Return fees;
//}
// Else return-1;
}
}

Package com. Infosys. onon_liu02.test;

Public class demoreg {
Public static void main (string [] ARGs ){
Registration Reg = new registration ();
Reg. setregistrationid (2001 );
Int branchid = 1002;
Switch (branchid ){
Case 1001:
Reg. setfetes (25575.0 );
Break;
Case 1002:
Reg. setfetes (15500.0 );
Break;
Case 1003:
Reg. setfetes (33750.0 );
Break;
Case 1004:
Reg. setfetes (8350.0 );
Break;
Case 1005:
Reg. setfetes (20500.0 );
Break;
}
Reg. setfees (Reg. calculatees (68 ));
System. Out. println ("registration ID:" + Reg. getregistrationid ());
System. Out. println ("Fees:" + Reg. getfees ());
}
}

Package com. Infosys. onon_liu02.test;

Public class forloop {
Public static void main (string ARGs []) {
For (INT I = 50; I <80; I ++ ){
If (I % 2 = 0 ){
System. Out. println (I );
} Else {

Break;
}
}
}
}

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.