QB64.org Forum

Active Forums => Programs => Topic started by: Kernelpanic on September 05, 2020, 02:56:13 pm

Title: Calculated the end total
Post by: Kernelpanic on September 05, 2020, 02:56:13 pm
Calculated the end total of a constant annual capital deposit. Payable in advance and annually in arrears(?) - Financial English!

It is an old program, written with QB4.02b now convert in QB64 - and it is in German.

Code: QB64: [Select]
  1. '1200.001Berechnet ein angesammeltes Kapital nach n Jahren,
  2. 'Siehe -Duden Mathematik- S.540f                   -  5. Okt.  1994
  3. 'Ausdruck der Daten                                       - 12. M„rz  1995
  4. 'Vor- und Nachschssige Berechnung und Ausdruck    - 15. Sept. 1996
  5. 'Calculated the end total of a constant annual capital deposit - Sept 2020
  6. '=========================================================================
  7.  
  8. DECLARE SUB Drucken (Einzahlung AS DOUBLE, Zinssatz AS SINGLE, Zeit AS INTEGER, q AS DOUBLE)
  9.  
  10. DIM Einzahlung AS DOUBLE, EndKapVor AS DOUBLE, EndKapNach AS DOUBLE
  11. DIM Zeit AS INTEGER, Zinswert AS SINGLE, q AS DOUBLE
  12. DIM Zaehler AS INTEGER, ZwiSumVor AS DOUBLE, ZwiSumNach AS DOUBLE
  13. DIM Spalte AS INTEGER
  14. DIM Antwort AS STRING
  15. '--------------------------------------------------------------
  16. DIM SHARED Datum AS STRING, Monat AS STRING
  17.  
  18.  
  19. 'Bildschirmfarbe: Weiss auf Blau
  20. COLOR 15, 1
  21.  
  22. 'Muss im Hauptmodul stehen, s.a. N61 "B.-Befehlsverzeichnis"
  23. Datum$ = DATE$
  24. FOR I% = 1 TO VAL(Datum$)
  25.   READ Monat$
  26. DATA Januar,Februar,Maerz,April,Mai,Juni,Juli
  27. DATA August,September,Oktober,November,Dezember
  28.  
  29. Tag$ = MID$(Datum$, 4, 2)
  30. IF LEFT$(Tag$, 1) = "0" THEN Tag$ = RIGHT$(Tag$, 1)
  31. Jahr$ = RIGHT$(Datum$, 4)
  32.  
  33. LOCATE 1, 12
  34. PRINT "BERECHNET ZU WELCHER ENDSUMME SICH EINE GLEICHBLEIBENDE"
  35. LOCATE 2, 21
  36. PRINT "JÄHRLICHE KAPITALEINZAHLUNG SUMMIERT"
  37. FOR I% = 1 TO 80
  38.   PRINT "Ü";
  39. COLOR 15, 1
  40. LOCATE 5, 3
  41. INPUT "Geben Sie die j„hrliche Einzahlung ein ( Euro ) : ", Einzahlung
  42. LOCATE 6, 3
  43. INPUT "Geben Sie den Zinsfuá ein ( % )                 : ", Zinswert
  44. LOCATE 7, 3
  45. INPUT "Geben Sie die Einzahlungsdauer ( Jahre ) ein    : ", Zeit
  46. IF Zeit > 99 THEN
  47.   Zeit = 99
  48.  
  49. 'Zinsfaktor berechnen
  50. q = (1 + (Zinswert / 100))
  51.  
  52. LOCATE 9, 44
  53. PRINT "Vorschssig    ³   Nachschssig"
  54.  
  55. Spalte = 40
  56. FOR I% = 1 TO 39
  57.   LOCATE 10, Spalte
  58.   PRINT "Ä"
  59.   Spalte = Spalte + 1
  60.  
  61. Zaehler = 5
  62. WHILE Zaehler < Zeit
  63.   ZwiSumVor = (Einzahlung * q * (((q ^ Zaehler) - 1) / (q - 1)))
  64.   ZwiSumNach = (Einzahlung * (((q ^ Zaehler) - 1) / (q - 1)))
  65.   LOCATE , 3
  66.   PRINT USING "Das Kapital betr„gt nach ## Jahren: ###,###,###.## Euro ³ ###,###,###.## Euro"; Zaehler; ZwiSumVor; ZwiSumNach
  67.   Zaehler = Zaehler + 5
  68.   'Spielt nur bei Einer-Schritten eine Rolle
  69.   'IF Zaehler = Zeit THEN GOTO WEITER
  70.  
  71. 'WEITER:
  72. EndKapVor = (Einzahlung * q * (((q ^ Zeit) - 1) / (q - 1)))
  73. EndKapNach = (Einzahlung * (((q ^ Zeit) - 1) / (q - 1)))
  74.  
  75. 'Wird mit einer Variablen "Zeile" gearbeitet, kommt es zum Programmabbruch,
  76. 'wenn die Ausgabe ber 25 Zeilen hinausgeht.
  77. LOCATE , 3
  78. PRINT USING "Endkapital nach ## Jahren         : "; Zeit;
  79.  
  80. LOCATE , 39
  81. PRINT USING "###,###,###.## Euro"; EndKapVor;
  82. LOCATE , 61
  83. PRINT USING "###,###,###.## Euro"; EndKapNach;
  84.  
  85. LOCATE , 41
  86. PRINT "=================";
  87. LOCATE , 63
  88. PRINT "=================": PRINT
  89.  
  90. END '*** Ende Hauptprogramm ***
  91.  
Title: Re: Calculated the end total
Post by: bplus on September 05, 2020, 03:23:37 pm
Next a program to convert Euro to Dollar :)

Welcome to forum, Kernelpanic

Title: Re: Calculated the end total
Post by: Kernelpanic on September 05, 2020, 04:31:39 pm
Quote
Next a program to convert Euro to Dollar :)
Ha, ha, ha, . . . ;-)

Thank you!
It was a nice time with Basic. My first contact with programming was with Apple Basic.


Title: Re: Calculated the end total
Post by: FellippeHeitor on September 05, 2020, 04:45:13 pm
Welcome aboard!
Title: Re: Calculated the end total
Post by: Kernelpanic on September 07, 2020, 05:20:09 pm
Thanks, Fellippe!

And I have a problem: I have forgotten how I have convert a QB 4.02 program that I then can load it in QB64. I can not see my old QB programs.
Title: Re: Calculated the end total
Post by: FellippeHeitor on September 07, 2020, 05:22:23 pm
I don't think I understand your problem. Care to elaborate?
Title: Re: Calculated the end total
Post by: SMcNeill on September 07, 2020, 05:24:26 pm
I don't think I understand your problem. Care to elaborate?

Sounds like the program was saved in tokenized (non-text) format.  If that’s the issue, there should be a link to a conversion program in the wiki.
Title: Re: Calculated the end total
Post by: FellippeHeitor on September 07, 2020, 05:29:16 pm
The conversion program has been integrated into the IDE, but it won't load QB4.02 format. It'll only work with QB4.5 format. Unless there wasn't a change between those two versions.
Title: Re: Calculated the end total
Post by: Kernelpanic on September 07, 2020, 05:41:13 pm
Yeah, how can it in English say? I don't know.
In German:
Vor einigen Monaten ist mein Rechner kaputt gegangen, und ich mußte meinen uralt, eingemotteten Rechner mit Win XP wieder reaktivieren . . . vielleicht habe ich in der Zeit das alte QB-Programm in QB64 übersetzt - eine andere Erklärung habe ich nicht. Ich habe alles probiert was ich finden konnte - Null.

Exuse me, but so is it.
Title: Re: Calculated the end total
Post by: FellippeHeitor on September 07, 2020, 05:42:21 pm
Attach the file here and let us have a look.
Title: Re: Calculated the end total
Post by: Kernelpanic on September 08, 2020, 01:33:55 pm
Hello, this is what it looks when I open old programs in QB64. With some it works, maybe I loaded them into QuickBasic as text under Win XP and then transferred them to QB64.
I'll try to install MS-DOS in Hyper-V, and then QuickBasic. Let's see.

Title: Re: Calculated the end total
Post by: Kernelpanic on September 08, 2020, 04:09:13 pm
The file: