الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

المساعدة في برنامج للبنك وحساب الفائدة

بدأه kousai في 25 مايو 2008 · 6 رد · 2,558 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

مرحبا للجميع

أنا مبتدأ جافا وعندي مشكلة بهل البرنامج وماعم اعرف كيف بدي ابدا فيه

البرنامج عبارة عن انشاء بنك بعدة حسابات وكيفية حساب الفائدة السنوية

ياريت منكم تساعدوني وانا رح بلش بالبرنامج هلق واللي بقدر عليه رح ارفعو عالموقع بلكي منتناقش فيو وبستفيد من خبرتكم

................................................................................

...........

البرنامج هو التالي .:

  • يجب انشاء ميثودات لحساب فوائد بنك ما على ان تكون هذه الميثودات قادرة على حساب فوائد الفوائد(اي الفوائد من الفوائد)
  • من أجل حساب الفوائد أكتب كلاس Accounting الذي يحتوي على ميثودات مع متغيرات calculateInterest(........)
  • يوجد نوعين من الحسابات التي بتم تمثيلها عن طريق كلاسات مختلقة .... وهنا لدينا الحساب الثابت(FixedDeposit) وحساب التوفير (SavingsAgreement ) وهدان النوعان من الحسابات يشتركان بعدة صفات

أولا : يجب ان يمتل اسم صاحب الحساب والمبلغ البدائي المودوع في الحساب على شكل متغيرات مثلا String ,int,double etc.في كلا الكلاستين

علينا وضع قيمة المبلغ البدائي المودوع عند انشاء الحساب وكذلك أسم صاحب الحساب مع مراعاة عم المقدرة على تغيير اسم صاحب الحساب مطلقا

لا يمكن وضع حساب بدون اسم المالك والمبلغ البدائي الموضوع في الحساب

ثانيا: لكلا نوعي الحسابات سواء الثابت او التوفير قيم محددة لحساب الفوائد وهده القيم تحدد عن طريق المتغير interest على ان يكون static وان نتمكن مع تغيير قيمته من خارج الكلاس ايضا

ثالثا: غير ذلك يجب ان نمثل ال account_statment بطريقة بسيطة وهي اضهار أسم مالك الحساب والمبلغ الموجود حاليا في الحساب فرضا كالتالي

Willz Meyer 103,25 EUR

Franz Mueller 2665,00EUR

  1. لحل هدا البرنامج قم بأنشاء الكلاستين FixedDeposit و SavingsAgreement وأصنع ال constructors المناسبة وكدلك اكتب ميثودات الset and get وميثود اظهار النتاشج out.print وكذلك ينبغي علينا ان نحدد الفوائد السنوية للحساب الثابت ب 4,5% وحساب التوفير 3,2%
  2. أكتب في كلا الحسابين ميثود حساب الفوائد calculateInterest(.............) على ان تكون هده المثود قادرة على اعطاء الحساب مع الوقت بالاشهر
    مثلا يجب اضهار النتائج كما يلي :
    The calculation of Interest for 12 months start
    A. Shulze, month 1: 802,13 EUR
    A. Shulze, month 2: 804,27 EUR
    A. Shulze, month 3: 806,42 EUR
    ..........................................
    ..........................................
    A. Shulze, month 12: 825,98 EUR
  3. أكنب كلاس بأسم Bank وقم بأنشاء عدة حسابات واجري عملية حساب الفائدة
    فقم بأنشاء 3 حسابت توفيرية SavingsAgreement بمبلغ بدائي كالتالي 100EUR and 2.500EUR and 800EUR
    وايضا انشأ حساب ثابت FixedDeposit بمبلغ وقدره 800EUR ويترك لك حرية تسمية اصحاب الحسابت
    _قم بأضهار نتائج ال account_statment للحسابات الاربعة
    _ أحسب الفوائد لسنة واحدة لكل الحسابات ماعدا الحساب التوفيري ذو المبلغ 2500 فيجب حساب فوائده لسنتين
    _بين اخيرا تغيير قيم المبالغ في الحسابات
    ؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟

أنا سوف احاول ان ابدأ بحل هدا البرنامج وسوف ارفع ما استطيع برمجه على الموقع الرجاء ممن يملك الخبرة ان يساعدني حتى ولو بملاحضات بسيطة

ارجو ان اكون قد تمكنت من توصيل فكرة البرنامج كما يجب

انتظرو مااستطيعه وانتظر منكم مساعدتكم

شــــــــــــــــــــــــــــــــــــــــــــــــــكرا لكم

#2

لقد تمكنت من البدء في البرنامج وصنعت الكلاستين وهنا اريد منكم ان تفحصو الاكواد اذا كانت صحيحة وارجو منكم تزويدي بملاحضاتكم

package Aufgabe2;

public class SavingsAgreement {

private String name;

double balance;

double interest;

public String getName(){

return name;

}

public void setBalance(double balance) {

this.balance = balance;

}

public double getBalance() {

return balance;

}

public void setInterest(double interest){

this.interest = (3.2 / 100);

}

public double getInterest(){

return interest;

}

public SavingsAgreement(String name, double balance){

this.name = name;

this.balance = balance;

}

public void print_State(){

System.out.println(name +" "+ balance + " "+"EUR");

}

public static void main(String [] args){

SavingsAgreement s1 = new SavingsAgreement("Willy Meyer", 103.25);

SavingsAgreement s2 = new SavingsAgreement("Franz Mueller", 2665.00);

s1.print_State();

s2.print_State();

}

}

تم تعديل هذه المشاركة بواسطة kousai في 25 مايو 2008 في 01:30

#3

package Aufgabe2;

public class FixedDeposit {

private String name;

double balance;

double interest;

public String getName(){

return name;

}

public void setBalance(double balance) {

this.balance = balance;

}

public double getBalance() {

return balance;

}

public void setInterest(double interest){

this.interest = (4.5 / 100);

}

public double getInterest(){

return interest;

}

public FixedDeposit(String name, double balance){

this.name = name;

this.balance = balance;

}

public void print_State(){

System.out.println(name + " " + balance + " " + "EUR" );

}

public static void main(String []args){

FixedDeposit f1 = new FixedDeposit("Willy Meyer", 103.25);

FixedDeposit f2 = new FixedDeposit("Franz Mueller", 2665.00);

f1.print_State();

f2.print_State();

}

}

#4

البرنامج خلص وانا رح ارفع كل الكلاسس عالموقع واللي عندو اي سؤال او ملاحظة انا جاهز

اولا كلاس الحساب الثابت

package Aufgabe2;

public class FixedDeposit {

private String name;

double balance;

public static double interest= 4.5;

public String getName(){

return name;

}

public void setBalance(double balance) {

this.balance = balance;

}

public double getBalance() {

return balance;

}

public FixedDeposit(String name, double balance){

this.name = name;

this.balance = balance;

}

public void print_State(){

System.out.println(name + " " + balance + " " + "EUR" );

}

public static void main(String []args){

FixedDeposit f1 = new FixedDeposit("Willy Meyer", 103.25);

FixedDeposit f2 = new FixedDeposit("Franz Mueller", 2665.00);

f1.print_State();

f2.print_State();

}

}

.....................................

ثانياكلاس حساب التوفير

package Aufgabe2;

public class SavingsAgreement {

private String name;

double balance;

double interest = 3.2;

public String getName(){

return name;

}

public void setBalance(double balance) {

this.balance = balance;

}

public double getBalance() {

return balance;

}

public void setInterest(double interest){

this.interest = (3.2 / 100);

}

public double getInterest(){

return interest;

}

public SavingsAgreement(String name, double balance){

this.name = name;

this.balance = balance;

}

public void print_State(){

System.out.println(name +" "+ balance + " "+"EUR");

}

public static void main(String [] args){

SavingsAgreement s1 = new SavingsAgreement("Willy Meyer", 103.25);

SavingsAgreement s2 = new SavingsAgreement("Franz Mueller", 2665.00);

s1.print_State();

s2.print_State();

}

}

..........................................

ثالثا كلاس حساب الفائدة

package Aufgabe2;

public class Accounting {

// The calculation of Interest for FixedDeposit

public void calculateInterest(FixedDeposit account, int month){

for (int i = 0; i< month; i++){

double interest = (account.getBalance() * account.interest)/100;

double month_interest = (interest / 12);

account.setBalance(account.getBalance() + month_interest );

System.out.println(account.getName() + " , "+ " Month " + (i+1) + ":" + " "+ account.getBalance() + " " + "EUR (" + month_interest + " )" );

}

}

//The calculation of Interest for SavingsAgreement

public void calculateInterest(SavingsAgreement account, int month){

for (int i = 0; i< month; i++){

double interest = (account.getBalance() * account.interest)/100;

double month_interest = (interest / 12);

account.setBalance(account.getBalance() + month_interest );

System.out.println(account.getName() + " , "+ " Month " + (i+1) + ":" + " "+ account.getBalance() + " " + "EUR (" + month_interest + " )" );

}

}

public static void main(String []args){

System.out.println( "The calculation of Interest for a FixedDeposit Account");

FixedDeposit f1 = new FixedDeposit("A. Schulze", 800.00);

f1.print_State();

Accounting ac1 = new Accounting();

ac1.calculateInterest(f1, 3);

System.out.println("___________________________");

System.out.println( "The calculation of Interest for a SavingsAgreement Account");

SavingsAgreement sa = new SavingsAgreement("A.Schulze", 800.00);

sa.print_State();

Accounting ac2 = new Accounting();

ac2.calculateInterest(sa, 3);

}

}

.......................

اخيرا كلاس البنك

package Aufgabe2;

public class Bank {

public static void main(String []args){

SavingsAgreement s1 = new SavingsAgreement("Yassar", 100);

SavingsAgreement s2 = new SavingsAgreement("Amar", 2500);

SavingsAgreement s3 = new SavingsAgreement("Suhad", 800);

FixedDeposit fi1 = new FixedDeposit("Hamza", 800);

System.out.println("Account-Statment for the 3 SavingsAgreements");

s1.print_State();

s2.print_State();

s3.print_State();

System.out.println("Account-Statment for the FixedDeposit");

fi1.print_State();

System.out.println("-----------------------------------");

System.out.println("The calculation of Interest for a SavingsAgreement Account");

Accounting a1 = new Accounting();

Accounting a2 = new Accounting();

Accounting a3 = new Accounting();

System.out.println("Interest for Yassar");

a1.calculateInterest(s1, 12);

System.out.println("actuell Account-Statment of Yassar");

System.out.println(s1.getBalance());

System.out.println("------------------------------------");

System.out.println("Interest for Amar");

a2.calculateInterest(s2, 12);

a2.calculateInterest(s2, 24);

System.out.println("actuell Account-Statment of Amar");

System.out.println(s2.getBalance());

System.out.println("------------------------------------");

System.out.println("Interest for Suhad");

a3.calculateInterest(s3, 12);

System.out.println("actuell Account-Statment of Suhad");

System.out.println(s3.getBalance());

SavingsAgreement ss = new SavingsAgreement("kousai", 290);

ss.interest = 2.2;

Accounting aa = new Accounting();

aa.calculateInterest(ss, 2);

}

}

#5

للأسف ماعم اعرف كيف بدي ارفع الكود بطريقة صحيحة

package Aufgabe2;

public class SavingsAgreement {
 private String name;
 double balance;
 double interest = 3.2;


 public String getName(){
  return name;
 }

 public void setBalance(double balance) {
  this.balance = balance;
 }

 public double getBalance() {
  return balance;
 }
 public void setInterest(double interest){
  this.interest = (3.2 / 100);
 }
 public double getInterest(){
  return interest;

 }
 public SavingsAgreement(String name, double balance){
  this.name = name;
  this.balance = balance;

 }
 public void print_State(){
  System.out.println(name +"  "+ balance + " "+"EUR");

 }

 public static void main(String [] args){
  SavingsAgreement s1 = new SavingsAgreement("Willy Meyer",  103.25);
  SavingsAgreement s2 = new SavingsAgreement("Franz Mueller",  2665.00);

  s1.print_State();
  s2.print_State();
 }

}

package Aufgabe2;

public class FixedDeposit {
 private String name;
 double balance;
 public static double interest= 4.5;


 public String getName(){
  return name;
 }

 public void setBalance(double balance) {
  this.balance = balance;
 }

 public double getBalance() {
  return balance;
 }
 /*public void setInterest(double interest){
  this.interest = (4.5 / 100);
 }
 public double getInterest(){
  return interest;

 }*/
 public FixedDeposit(String name, double balance){
  this.name = name;
  this.balance = balance;

 }
 public void print_State(){
  System.out.println(name + "  " + balance + " " + "EUR" );
 }
 public static void main(String []args){
  FixedDeposit f1 = new FixedDeposit("Willy Meyer", 103.25);
  FixedDeposit f2 = new FixedDeposit("Franz Mueller", 2665.00);

  f1.print_State();
  f2.print_State();
 }

}

package Aufgabe2;

public class Accounting {

 // The calculation of Interest for FixedDeposit
 public void calculateInterest(FixedDeposit account, int month){
  for (int i = 0; i< month; i++){
   double interest = (account.getBalance() * account.interest)/100;
   double month_interest = (interest / 12);
   account.setBalance(account.getBalance() + month_interest );

   System.out.println(account.getName() + " , "+ " Month " + (i+1) + ":" + "   "+ account.getBalance() +  "  " + "EUR (" + month_interest + " )" );
  }
 }
 //The calculation of Interest for SavingsAgreement
 public void calculateInterest(SavingsAgreement account, int month){
  for (int i = 0; i< month; i++){
   double interest = (account.getBalance() * account.interest)/100;
   double month_interest = (interest / 12);
   account.setBalance(account.getBalance() + month_interest );

   System.out.println(account.getName() + " , "+ " Month " + (i+1) + ":" + "   "+ account.getBalance() +  "  " + "EUR (" + month_interest + " )" );
  }
 }


  public static void main(String []args){

   System.out.println( "The calculation of Interest for a FixedDeposit Account"); 
   FixedDeposit f1 = new FixedDeposit("A. Schulze", 800.00);
   f1.print_State();
   Accounting ac1 = new Accounting();
   ac1.calculateInterest(f1, 3);
   System.out.println("___________________________");
   System.out.println( "The calculation of Interest for a SavingsAgreement Account"); 
   SavingsAgreement sa = new SavingsAgreement("A.Schulze", 800.00);
   sa.print_State();
   Accounting ac2 = new Accounting();
   ac2.calculateInterest(sa, 3);


 }

}

package Aufgabe2;

public class Bank {
 public static void main(String []args){
 SavingsAgreement s1 = new SavingsAgreement("Yassar", 100);
 SavingsAgreement s2 = new SavingsAgreement("Amar", 2500);
 SavingsAgreement s3 = new SavingsAgreement("Suhad", 800);
 FixedDeposit fi1 = new FixedDeposit("Hamza", 800);

 System.out.println("Account-Statment for the 3 SavingsAgreements");
 s1.print_State();
 s2.print_State();
 s3.print_State();
 System.out.println("Account-Statment for the FixedDeposit");
 fi1.print_State();
 System.out.println("-----------------------------------");
 System.out.println("The calculation of Interest for a SavingsAgreement Account");
 Accounting a1 = new Accounting();
 Accounting a2 = new Accounting();
 Accounting a3 = new Accounting();
 System.out.println("Interest for Yassar");
 a1.calculateInterest(s1, 12);
 System.out.println("actuell Account-Statment of Yassar");
 System.out.println(s1.getBalance());
 System.out.println("------------------------------------");
 System.out.println("Interest for Amar");
 a2.calculateInterest(s2, 12);
 a2.calculateInterest(s2, 24);
 System.out.println("actuell Account-Statment of Amar");
 System.out.println(s2.getBalance());
 System.out.println("------------------------------------");
 System.out.println("Interest for Suhad");
 a3.calculateInterest(s3, 12);
 System.out.println("actuell Account-Statment of Suhad");
 System.out.println(s3.getBalance());


 SavingsAgreement ss = new SavingsAgreement("kousai", 290);
 ss.interest = 2.2;
 Accounting aa = new Accounting();
 aa.calculateInterest(ss, 2);
 }


}
#6

واين السؤال ؟

where is the question ?

مواضيع مشابهة