package com.company;
import java.util.Scanner;
public class Calculation {
private double money;
private int installment;
private double interest;
public void setMoney(double money) {
this.money = money;
}
public void setInstallment(int installment) {
this.installment = installment;
}
public double getMoney() {
return money;
}
public int getInstallment() {
return installment;
}
public void setInterest(double interest) {
this.interest = interest;
}
public double getInterest() {
return interest;
}
public void enterAmountMoney() {
Scanner moneyScanner
= new Scanner
(System.
in);
setMoney(moneyScanner.nextDouble());
if (getMoney() > 300000) {
while (getMoney() > 300000) {
setMoney(moneyScanner.nextDouble());
}
}
}
public void enterInstallment() {
Scanner installmentScanner
= new Scanner
(System.
in);
setInstallment(installmentScanner.nextInt());
if (getInstallment() > 96) {
while (getInstallment() > 96) {
Dialog.
isTooMuchInstallment();
setInstallment(installmentScanner.nextInt());
}
}
}
public double calc() {
if (getInstallment() < 25) {
setInterest(getMoney() * 0.02);
return getInterest();
} else if (getInstallment() > 24 && getInstallment() < 49) {
setInterest(getMoney() * 0.03);
return getInterest();
} else if (getInstallment() > 48 && getInstallment() < 61) {
setInterest(getMoney() * 0.04);
return getInterest();
} else if (getInstallment() > 60 && getInstallment() < 72) {
setInterest(getMoney() * 0.05);
return getInterest();
} else {
setInterest(getMoney() * 0.06);
return getInterest();
}
}
public void presentsResult() {
}
}
public static void enterEquity()
{
System.
out.
print("Wprowadź Twój kapitał własny: ");
}
public static void enterInstallments()
{
System.
out.
print("Wprowadź ilość rat: ");
}
public static void isTooMuchInstallment()
{
System.
out.
println("Za duzo rat");
}
public static void isTooMuchMoney()
{
System.
out.
println("Za duzo pieniędzy");
}
}
public class Main {
public static void main
(String[] args
) {
Calculation calculation = new Calculation();
calculation.enterInstallment();
calculation.enterAmountMoney();
calculation.calc();
calculation.presentsResult();
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}