0% found this document useful (0 votes)
29 views2 pages

Created by PG Mad Sariy'Nis BI18110127 Lab3: Lastcre Lastpay Lastcre Lastpay

The document contains code for a Finance class with methods to calculate debit amounts based on fees, credits, and payments. It has constructors to initialize objects with and without parameters. The main method creates two Finance objects, sets their attributes, and calls print to output the semester, session, fees, remaining debit, last payment date and amount.

Uploaded by

kamal khairi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Created by PG Mad Sariy'Nis BI18110127 Lab3: Lastcre Lastpay Lastcre Lastpay

The document contains code for a Finance class with methods to calculate debit amounts based on fees, credits, and payments. It has constructors to initialize objects with and without parameters. The main method creates two Finance objects, sets their attributes, and calls print to output the semester, session, fees, remaining debit, last payment date and amount.

Uploaded by

kamal khairi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

package lab3;

/* Created by Pg Mad Sariy'Nis


* BI18110127
* Lab3
* @Copyrighted */

public class Finance {


private byte Sem;
private String Session;
private double Fees;
private double totalCredit;
private double remainingDebit;
private String lastPayDate;
private double lastCredit;

// calling
void calculateDebit() {
this.remainingDebit = Fees - totalCredit;
}
void payment(double lastcre ,String lastpay) {
this.lastCredit = lastcre;
this.lastPayDate = lastpay;
this.totalCredit += lastCredit;
calculateDebit();
}
Finance(){
this.Sem =0;
this.Session = "";
this.lastPayDate = "";
this.totalCredit = 0;
this.lastCredit = 0;
this.Fees = 0;
this.remainingDebit = 2000.00;
}
Finance(int s,String ses,double fee,String lastpay,double lastcre){
this.Sem=(byte)s;
this.Session=ses;
this.Fees=fee;
this.lastPayDate=lastpay;
this.lastCredit=lastcre;
payment(lastcre, lastpay);
calculateDebit();
}
void setSem(int s) {
this.Sem=(byte)s;
}
void setSession(String ses) {
this.Session=ses;
}
void setFees(double fee) {
this.Fees=fee;
}
void setlastPayDate(String lastpay) {
this.lastPayDate=lastpay;
}
void setlastCredit(double lastcre) {
this.lastCredit=lastcre;
}
void print() {
System.out.println("Sem: "+Sem+" "+"Session: "+Session);
System.out.println("Fees: "+Fees+" "+"Remaining: "+remainingDebit);
System.out.println("Last Payment: "+lastCredit+" on "+lastPayDate);
}

package lab3;
/* Created by Pg Mad Sariy'Nis
* BI18110127
* Lab3
* @Copyrighted */

public class demoFinance {


public static void main (String [] args) {
Finance a = new Finance();
a.setSem(1);
a.setSession("2016/2017");
a.setFees(3000);
a.setlastPayDate("13-09-2016");
a.setlastCredit(1000);
a.print();

System.out.println();

Finance b = new Finance(2,"2016/2017",3000,"14-02-2017",2000);


b.print();
}

You might also like