- #1
Euler2718
- 90
- 3
Essentially, my problem is to: design a program that takes the following information:
-a persons ID
-a houses ID
-listing price of house
-selling price of house
and write the input to a text file, called Sales.txt. Secondly, based on the list and selling price, commission is calculated based on some conditions. After everything has been entered, the persons ID, the houses ID, and the final commission price has to be written to another text file called Commissions.txt; this info on Commissions.txt also has to be printed to the screen.
I also need to include exception handling for if the user inputs an invalid form. Let's assume the input form is that of: PPPPP HHHH LLLLLL SSSSSS
of course the prices wouldn't really need to be concerned as the prices could theoretically be anything, but the two id's would need a particular form.
So my problem is I haven't a clue how to start. I've learned the basics of being able to read a text file and write in the editor to the file, but how do I go about having a user input multiple lines of text and have that then written to the .txt files in question? I'm guessing there would be a while loop in there. My biggest concern is not knowing how to deal with the multiple inputs and writing to the text files.
Any insight would be great.
-a persons ID
-a houses ID
-listing price of house
-selling price of house
and write the input to a text file, called Sales.txt. Secondly, based on the list and selling price, commission is calculated based on some conditions. After everything has been entered, the persons ID, the houses ID, and the final commission price has to be written to another text file called Commissions.txt; this info on Commissions.txt also has to be printed to the screen.
I also need to include exception handling for if the user inputs an invalid form. Let's assume the input form is that of: PPPPP HHHH LLLLLL SSSSSS
of course the prices wouldn't really need to be concerned as the prices could theoretically be anything, but the two id's would need a particular form.
So my problem is I haven't a clue how to start. I've learned the basics of being able to read a text file and write in the editor to the file, but how do I go about having a user input multiple lines of text and have that then written to the .txt files in question? I'm guessing there would be a while loop in there. My biggest concern is not knowing how to deal with the multiple inputs and writing to the text files.
Any insight would be great.