Results 1 to 4 of 4
Thread: How to split a file into 2?
- 09-26-2009, 02:00 AM #1
Member
- Join Date
- Sep 2009
- Location
- http://www.kouje.com
- Posts
- 16
- Rep Power
- 0
How to split a file into 2?
this is for a school project, and this program is suppose to be in 2 files, using the "set" and "get" things,,, but I still haven't really understood them. I coded my program in a single file and i need help on how to split it into 2,, the code works just fine. and the "CurrentDateTime" class is working just fine. here's the code:
Java Code:import java.text.*; import java.util.Scanner; import java.text.DecimalFormat; /** * @author ;) * @version 4.00 2009/9/22 */ public class Assignment04 { public static void main(String args[]) { String input; //to hold user's input char pk_type; Double pk_price; Double internetHours; Double payPrice; // Get current date CurrentDateTime today = new CurrentDateTime(); // read input Scanner keyboard = new Scanner(System.in); // decimal format object DecimalFormat formatter = new DecimalFormat("#,##0.00"); // Print Date System.out.println("''''''''''''''''''''''''''''''''''"); System.out.println(today.getDateTime()); System.out.println("''''''''''''''''''''''''''''''''''\n"); // get internet package type System.out.print("Enter your Internet package type: "); input = keyboard.nextLine(); System.out.print("For how many hours did you surf the web? "); internetHours = keyboard.nextDouble(); pk_type = input.charAt(0); /** ********************************************************************************************* ************************************* CUT HERE? ********************************************** ********************************************************************************************* */ // determine the package type switch(pk_type) { case 'a': case 'A': if(internetHours > 10) { payPrice = internetHours + 2; System.out.println("****** You went over your monthly limit of 10 hours. " + "This month's bill is $" + formatter.format(payPrice) + " ******"); } else { System.out.println("Package A this month's bill is: $9.95"); } break; case 'b': case 'B': if(internetHours > 20) { payPrice = internetHours + 1; System.out.println("You went over your monthly limit of 20 hours. " + "This month's bill is $" + formatter.format(payPrice)); } else { System.out.println("Package B this month's bill is: $14.95"); } break; case 'c': case 'C': System.out.println("Package C has Unlimited internet acces. This month's bill is: $19.95"); break; default: System.out.println("Invalid internet package. Please choose between package A, package B, or package C. SINGLE LETTERS ONLY"); } } }Last edited by Fubarable; 09-26-2009 at 02:10 AM. Reason: Code tags added to aid in code readability
-
Code tags were added to the code in the original post to aid in readability.
-- mod
- 09-26-2009, 03:19 AM #3
Member
- Join Date
- Sep 2009
- Location
- http://www.kouje.com
- Posts
- 16
- Rep Power
- 0
-
Right now you don't even have two methods much less two files. What are your actual requirements?
Similar Threads
-
How to split a String using split function
By Java Tip in forum java.langReplies: 4Last Post: 04-17-2009, 08:27 PM -
split() by digits
By RobertF in forum New To JavaReplies: 2Last Post: 03-12-2009, 02:16 AM -
split Keyword
By santhoshrao in forum New To JavaReplies: 4Last Post: 08-13-2008, 10:28 AM -
how to split a file
By nagaraaju in forum New To JavaReplies: 0Last Post: 03-14-2008, 08:45 AM -
How to split a String using split function
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks