Sie sind auf Seite 1von 2

import javax.swing.

*; class Liabrary { private String name, id, bookcode; private int date,month,year; //normal constructor Liabrary( String n, String i, String b, int d, int m,int y) { name = n; id = i; bookcode = b; date = d; month= m; year=y; } String getName(){return name;} String getId(){return id;} String getBookcode(){return bookcode;} int getDate(){return date;} int getMonth(){return month;} int getYear(){return year;} } /* class Price { private double quantity, price; //normal constructor Price(double q, double p)

public double calculate() { double charge, payment, diffdate, diffmonth, diffyear,totdate,totmonth,totye ar=0.0; String command=" "; if ( totdate <= 7) { command= "Thank You For Borrow"; if (totmonth > 1) { command= "You must pay for due date"; diffmonth = totmonth - 1; charge = quantity * (charge +(diffmonth * 20.0)); // 1month = RM 20 if ( totyear > 1) { diffyear = totyear - 1; charge = quantity * (charge+(diffyear* 100.0)); // 1year= RM100 } } } else if ( totdate > 7)

{ command="You submit over due date! Please pay!"; diffdate=totdate-5; charge = diffdate * 0.5; // 1 day = RM 0.50 if (totmonth > 1) { diffmonth = totmonth - 1; charge = quantity*(charge +(diffmonth * 20.0)); // 1month = RM 20 if ( totyear > 1) { diffyear = totyear - 1; charge = quantity * (charge+(diffyear* 100.0)); // 1year= RM100 } } } return charge; } } */ class ask { public static void main (String [] perpustakaan) int quantity= Integer.parseInt (JOptionPane.showInputDialog(null,"Enter Your of the book : ")); int fdate= Integer.parseInt (JOptionPane.showInputDialog(null,"Enter date tod ay : ")); int fmonth= Integer.parseInt (JOptionPane.showInputDialog(null,"Enter month t oday : ")); int fyear= Integer.parseInt (JOptionPane.showInputDialog(null,"Enter year tod ay : ")); int ldate= Integer.parseInt (JOptionPane.showInputDialog(null,"Enter submit d ate today : ")); int lmonth= Integer.parseInt (JOptionPane.showInputDialog(null,"Enter submit month today : ")); int lyear= Integer.parseInt (JOptionPane.showInputDialog(null,"Enter submit y ear today : ")); }

Das könnte Ihnen auch gefallen