| | |
Please help with this program
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2009
Posts: 6
Reputation:
Solved Threads: 0
Hi, I am only beginning C#, so bear with me. I have been given this program to write. This is the question:
Write a C# application called WRITENUM that inputs a number between 0 and 2,000,000,000 inclusive and outputs that number in textual form, as we would say it or write it normally. For example if we input 1234011811 then the program will output “One billion, two hundred and thirty four million, eleven thousand, eight hundred and eleven.” If we input 0 then the program will output “Zero”. Note that commas and “and”s have been appropriately placed, the first letter of the output is capitalised, words are separated using a single space and the text ends with a full stop. A program such as this might be used as part of a financial package that prints cheques as part of its output, for example.
Your program will create a single form (window) that will allow the user to enter the number at the top and produce the textual equivalent in the middle. The form will have two buttons, a “Convert to text” button which will cause the number input by the user to be shown in textual format. The second button will be an “Exit” button which will cause the program to terminate. The program will allow the user to perform conversions until the program is terminated.
The values supplied by the user must be input into a variable of type int.
Now, I want to know is there a way to do this without having loads of if and else statements checking the numbers entered?
Write a C# application called WRITENUM that inputs a number between 0 and 2,000,000,000 inclusive and outputs that number in textual form, as we would say it or write it normally. For example if we input 1234011811 then the program will output “One billion, two hundred and thirty four million, eleven thousand, eight hundred and eleven.” If we input 0 then the program will output “Zero”. Note that commas and “and”s have been appropriately placed, the first letter of the output is capitalised, words are separated using a single space and the text ends with a full stop. A program such as this might be used as part of a financial package that prints cheques as part of its output, for example.
Your program will create a single form (window) that will allow the user to enter the number at the top and produce the textual equivalent in the middle. The form will have two buttons, a “Convert to text” button which will cause the number input by the user to be shown in textual format. The second button will be an “Exit” button which will cause the program to terminate. The program will allow the user to perform conversions until the program is terminated.
The values supplied by the user must be input into a variable of type int.
Now, I want to know is there a way to do this without having loads of if and else statements checking the numbers entered?
•
•
Join Date: Apr 2009
Posts: 18
Reputation:
Solved Threads: 2
This sounds like an interesting project.
I'll be able to help you with something like this. However it's going to be a bit of time before i can get something started for you.
are you using Visual c# 2005 or 2008?
do the commas need to be automatically placed in the text box as the user inputs the number, or is it required that the user place the comma's themselves?
I'll be able to help you with something like this. However it's going to be a bit of time before i can get something started for you.
are you using Visual c# 2005 or 2008?
do the commas need to be automatically placed in the text box as the user inputs the number, or is it required that the user place the comma's themselves?
Last edited by Acedia; Apr 5th, 2009 at 6:33 pm.
•
•
Join Date: Apr 2009
Posts: 6
Reputation:
Solved Threads: 0
•
•
•
•
This sounds like an interesting project.
I'll be able to help you with something like this. However it's going to be a bit of time before i can get something started for you.
are you using Visual c# 2005 or 2008?
do the commas need to be automatically placed in the text box as the user inputs the number, or is it required that the user place the comma's themselves?
The user just enters a number in a text box and when they click on the 'Convert to text' button, it displays the text as in the question. I am using SharpDevelop.
•
•
Join Date: Apr 2009
Posts: 18
Reputation:
Solved Threads: 2
For some reason it won't let me edit one of my last post, so sorry for double posting. But here it goes
what I'm going to do, cause this started getting very long, I'm going to post the source code to the program i created earlier for download. You can take what you want from it, but be advised that it's very sloppy, and should not be used as reference in programming.
I hope this helps here's the code, its zipped.
Convert to Text
what I'm going to do, cause this started getting very long, I'm going to post the source code to the program i created earlier for download. You can take what you want from it, but be advised that it's very sloppy, and should not be used as reference in programming.
I hope this helps here's the code, its zipped.
Convert to Text
•
•
Join Date: Apr 2009
Posts: 6
Reputation:
Solved Threads: 0
I cannot access the link to the zip file. It asks for a username and password. I have provided a screenshot of the problem below
http://www.piccdrop.com/images/1239185225.bmp
http://www.piccdrop.com/images/1239185225.bmp
•
•
Join Date: Apr 2009
Posts: 18
Reputation:
Solved Threads: 2
Here's a better link this link is direct, no password required. Sorry about that.
•
•
Join Date: Apr 2009
Posts: 6
Reputation:
Solved Threads: 0
The program works fine. Thanks for your help.
![]() |
Similar Threads
- Playing .Wav/MIDI files in a Visual Basic Program (Visual Basic 4 / 5 / 6)
- What's the HARDEST program you've written? (Computer Science)
- Cool little Program to disable startup programs (Windows NT / 2000 / XP)
- Program is shutting down right after program is executed (C++)
- 3d Program (Game Development)
Other Threads in the C# Forum
Views: 581 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button buttons c# chat check checkbox class client code color combobox control conversion csharp custom database datagridview dataset datetime degrees draganddrop drawing encryption enum excel file files form format forms ftp function gdi+ http image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





