Qbasicnews.com
February 26, 2020, 12:17:27 AM
 Pages: [1] 2 3
 Author Topic: Batter up!  (Read 9288 times)
pvera11
New Member

Posts: 8

 « on: September 08, 2003, 05:57:00 PM »

I need code,...give me code....naw j/k....lol

My new assignment is to construct a program that spells out the net pay for a check. example: if net pay is \$5,078.45 then it would be written out as follows five thousand seventy eight dollars and 45 cents......asuming that the net pay does not exceed \$9,999.99.

wer im at:----

Code:

cls
hundred\$="hundred"
thousand\$="thousand

input myvalue\$
pos1=instr(myvalue\$, ".")

mydollars\$=mid\$(myvalue\$, 1, pos1 -1)
mycents\$=mid\$(myvalue\$, pos1 + 1)

print mydollars\$

if pos1 <> 0 then

mydollars\$ = mid\$(myvalue\$, 1, pos1, -1)
mycents\$ = mid\$(myvalue\$, pos1 + 1)
else
mydollars\$=myvalue\$
mycents\$="00"

end if

places=LEN(mydollars\$)

dim twoplace\$(19)
for count=1to19
next

dim ten\$(10)
for count=2to9
next

(from here on its jus my data ex: data "one", "two", and so forth i stop at twenty, and start the tens,...ex. 20,30,40,50, and so forthe up to 90)

im not finished ofcourse but would like some help as to what i should fill in next........some more if statements?

pvera11 ::
 Logged
whitetiger0990
__/--\__

Posts: 2964

 « Reply #1 on: September 08, 2003, 06:10:36 PM »

Code:
IF num = 1 THEN PRINT "ONE"
IF num = 2 THEN PRINT "TWO"
IF num = 3 THEN PRINT "THREE"
IF num = 4 THEN PRINT "FOUR"
IF num = 5 THEN PRINT "FIVE"
IF num = 6 THEN PRINT "SIX"
IF num = 7 THEN PRINT "SEVEM"
IF num = 8 THEN PRINT "EIGHT"
IF num = 9 THEN PRINT "NINE"
IF num = 10 THEN PRINT "TEN"

like that...
j/k  :lol:
 Logged

[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
barok
Na_th_an

Posts: 1727

 « Reply #2 on: September 08, 2003, 07:02:58 PM »

first of all, put a " at the end of the thousand.  that's a start.
 Logged

Jumping Jahoolipers!
pvera11
New Member

Posts: 8

 « Reply #3 on: September 09, 2003, 11:21:09 AM »

:rotfl:

 Logged
Agamemnus
x/ \z

Posts: 3491

 « Reply #4 on: September 09, 2003, 08:24:53 PM »

This looks like it would be very complicated to get 100% correct.

Good luck.
 Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
oracle
*/-\*

Posts: 3652

 « Reply #5 on: September 09, 2003, 09:36:28 PM »

Add an american/english option, the english option prints "and" where there is a zero in a column before the decimal place (extra)
 Logged

Moneo
Na_th_an

Posts: 1971

 « Reply #6 on: September 10, 2003, 12:50:27 AM »

Oracle,
Give us an example of the English use of the "and". The American textual amount for a check only uses "and" before the cents, like \$40.00 converts to:  Forty and 00/100
with the word Dollars being part of the preprinted check at the end of the amount line, not part of the textual amount.
For some countries it is mandatory to include the currency name as part of the textual amount whether or not is is preprinted on the check. What is the English way?
*****
 Logged
whitetiger0990
__/--\__

Posts: 2964

 « Reply #7 on: September 10, 2003, 08:45:38 AM »

onehundred and one
 Logged

[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
heavenraiza
Member

Posts: 80

 « Reply #8 on: September 10, 2003, 09:00:45 AM »

i am doing the same assignment for my class  :-?
 Logged

here are 10 types of people, those that understand binary & those that dont. . .
whitetiger0990
__/--\__

Posts: 2964

 « Reply #9 on: September 10, 2003, 10:05:46 AM »

Quote from: "heavenraiza"
i am doing the same assignment for my class  :-?

this has happened a lot.
 Logged

[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Moneo
Na_th_an

Posts: 1971

 « Reply #10 on: September 10, 2003, 01:39:53 PM »

Quote from: "whitetiger0990"
onehundred and one

That may be the way you "say" it, but the way you write it on a  check is:
One hundred one and 00/100
*****
 Logged
Phydaux
Senior Member

Posts: 200

 « Reply #11 on: September 10, 2003, 04:59:23 PM »

Quote from: "Moneo"
...What is the English way?

The classic way to write £150.20, on a cheque in the UK, would be: One hundred and fifty pounds and twenty pence only. And the rest of the space for writing would be ruled through so no more text can be added.
 Logged

END OF LINE.
oracle
*/-\*

Posts: 3652

 « Reply #12 on: September 10, 2003, 05:53:28 PM »

Heh heh... they draw the line so the till operator can't squeeze in "and a hundred million pounds" :lol:

Moneo: To take the example used above: \$5078.45

American: Five thousand seventy eight dollars forty five cents.
English/Rest of the world: Five thousand and seventy eight dollars [and] forty five cents.

[and] sometimes included.

We use "and" to fill in gaps of zeroes, not just one, so \$100001 becomes "One hundred thousand and one dollars".

And the 00/100 method/thing: I've never heard of it before, and the challenge is about writing it in words
 Logged

SCM
Wandering Guru

Posts: 311

 « Reply #13 on: September 11, 2003, 02:44:41 AM »

In the U.S. we are taught to only use "and" at the decimal place.  This is a general rule for numbers.
So,

100001 = one hundred thousand one

and,

100001.001 = one hundred thousand one and one thousandth (or and one one thousandth).

It is a simple rule (which would fit the program fairly easily) but it is not always followed in everyday speech.  Whitetiger's
Quote
onehundred and one
is fairly common.

Moneo's "and 00/100" is the standard practice for for writing checks in the U.S.
 Logged

hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
relsoft
*/-\*

Posts: 3927

 « Reply #14 on: September 11, 2003, 03:55:56 AM »

Quote from: "Agamemnus"
This looks like it would be very complicated to get 100% correct.

Good luck.

Its been done. Ask Flexi. ;*)
 Logged

y smiley is 24 bit.

Genso's Junkyard:
http://rel.betterwebber.com/
 Pages: [1] 2 3