Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,65 @@
Module Currency_Task {
Locale 1033
Font "Courier New"
Form 80,32
\\Decimal type
hamburgers=4000000000000000@
\\ Currency type
hamburger_price=5.5#
milkshakes=2#
milkshake_price=2.86#
tax_rate=0.0765#
\\ Using Columns with variable width in console
PrHeadLine("Item","price","quantity", "value")
PrLine("hamburger",hamburger_price,hamburgers,hamburgers*hamburger_price)
PrLine("milkshake", milkshake_price,milkshakes,milkshakes*milkshake_price)
PrResults( "subtotal", hamburgers*hamburger_price+milkshakes*milkshake_price)
PrResults("tax", (hamburgers*hamburger_price+milkshakes*milkshake_price)*tax_rate)
\\ 1 is double by default we can use 1# or 1@
PrResults("total", (hamburgers*hamburger_price+milkshakes*milkshake_price)*(tax_rate+1))
\\ Using variables for partial calculations. They get type from expression result
h_p_q=hamburgers*hamburger_price
m_p_q=milkshakes*milkshake_price
\\ Using format$ to prepare final strings
Print format$("{0:15}{1:-8}{2:-25}{3:-25}","Item", "price", "quantity", "value")
Print format$("{0:15}{1:2:-8}{2:0:-25}{3:2:-25}","hamburger",hamburger_price,hamburgers, h_p_q)
Print format$("{0:15}{1:2:-8}{2:0:-25}{3:2:-25}","milkshake", milkshake_price,milkshakes,m_p_q)
Print format$("{0:-48}{1:2:-25}","subtotal", h_p_q+m_p_q)
Print format$("{0:-48}{1:2:-25}","tax", (h_p_q+m_p_q)*tax_rate)
Print format$("{0:-48}{1:2:-25}","total", (h_p_q+m_p_q)*(tax_rate+1))
\\ Another time to feed Document to export to clipboard
Document Doc$=format$("{0:15}{1:-8}{2:-25}{3:-25}","Item", "price", "quantity", "value")+{
}+format$("{0:15}{1:2:-8}{2:0:-25}{3:2:-25}","hamburger",hamburger_price,hamburgers, h_p_q)+{
}+format$("{0:15}{1:2:-8}{2:0:-25}{3:2:-25}","milkshake", milkshake_price,milkshakes,m_p_q)+{
}+format$("{0:-48}{1:2:-25}","subtotal", h_p_q+m_p_q)+{
}+format$("{0:-48}{1:2:-25}","tax", (h_p_q+m_p_q)*tax_rate)+{
}+format$("{0:-48}{1:2:-25}","total", (h_p_q+m_p_q)*(tax_rate+1))+{
}
clipboard Doc$
\\ one line user function definition
\\ x get type from passed value
Def ExpressionType$(x)=Type$(X)
\\ Check Expression final type
Print ExpressionType$(hamburgers)="Decimal"
Print ExpressionType$(milkshakes)="Currency"
Print ExpressionType$(h_p_q)="Decimal"
Print ExpressionType$(m_p_q)="Currency"
Print ExpressionType$((h_p_q+m_p_q)*tax_rate)="Decimal"
Print ExpressionType$((h_p_q+m_p_q)*(tax_rate+1))="Decimal"
Sub PrHeadLine(a$,b$,c$,d$)
Print Part $(1,15),a$,$(3,8),b$, $(3,25),c$, $(3,25),d$
Print
End Sub
Sub PrLine(a$,b,c,d)
Print Part $(1,15),a$,$("0.00"),$(3,8),b, $("0"),$(3,25),c,$("0.00"), $(3,25),d
Print
End Sub
Sub PrResults(a$,b)
Print Part $(3,48),a$,$("0.00"),$(3,25),b
Print
End Sub
}
Currency_Task

View file

@ -0,0 +1,42 @@
Module Currency_Task {
Locale 1033
Font "Courier New"
Form 80,32
hamburgers=4000000000000000@
hamburger_price=5.5#
milkshakes=2#
milkshake_price=2.86#
tax_rate=0.0765#
PrHeadLine("Item","price","quantity", "value")
PrLine("hamburger",hamburger_price,hamburgers,hamburgers*hamburger_price)
PrLine("milkshake", milkshake_price,milkshakes,milkshakes*milkshake_price)
PrResults( "subtotal", hamburgers*hamburger_price+milkshakes*milkshake_price)
PrResults("tax", (hamburgers*hamburger_price+milkshakes*milkshake_price)*tax_rate)
PrResults("total", (hamburgers*hamburger_price+milkshakes*milkshake_price)*(tax_rate+1))
h_p_q=hamburgers*hamburger_price
m_p_q=milkshakes*milkshake_price
Document Doc$=format$("{0:15}{1:-8}{2:-25}{3:-30}","Item", "price", "quantity", "value")+{
}+format$("{0:15}{1:-8}{2:-25}{3:-30}","hamburger",str$(hamburger_price,"$#,##0.00"),str$(hamburgers, "#,##0"), Str$(h_p_q,"$#,##0.00"))+{
}+format$("{0:15}{1:-8}{2:-25}{3:-30}","milkshake", str$(milkshake_price,"$#,##0.00"),Str$(milkshakes, "#,##0"), Str$(m_p_q,"$#,##0.00"))+{
}+format$("{0:-48}{1:-30}","subtotal", Str$(h_p_q+m_p_q,"$#,##0.00"))+{
}+format$("{0:-48}{1:-30}","tax", Str$((h_p_q+m_p_q)*tax_rate,"$#,##0.00"))+{
}+format$("{0:-48}{1:-30}","total", Str$((h_p_q+m_p_q)*(tax_rate+1),"$#,##0.00"))+{
}
clipboard Doc$
Sub PrHeadLine(a$,b$,c$,d$)
Print Part $(1,15),a$,$(3,8),b$, $(3,25),c$, $(3,30),d$
Print
End Sub
Sub PrLine(a$,b,c,d)
Print Part $(1,15),a$,$("$#,###.00"),$(3,8),b, $("#,##0"),$(3,25),c,$("$#,###.00"), $(3,30),d
Print
End Sub
Sub PrResults(a$,b)
Print Part $(3,48),a$,$("$#,###.00"),$(3,30),b
Print
End Sub
}
Currency_Task