The Artima Developer Community
Sponsored Link

Java Answers Forum
How to combine subfunction into Main Program

6 replies on 1 page. Most recent reply: Feb 29, 2004 9:56 AM by leonglkw

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 6 replies on 1 page
leonglkw

Posts: 43
Nickname: leonglkw
Registered: Feb, 2004

How to combine subfunction into Main Program Posted: Feb 27, 2004 12:07 PM
Reply to this message Reply
Advertisement
Hi Viswa and the rest I really need you guys.
This is very urgent, i am afraid that i cannot meet the deadline.


Problem:
Actually, i want to create a program that have a few sub-functions.
I have finished writing these sub-function using the strategy divide and conquer method.
Now I want to combine them into single program that is invoked from Command prompt.
After the sub-function is called, the main screen will appear again.

This is the main screen when the program is run from Commmand prompt.

ComputerMart, Madanne Amanda Smith

Category Favourite Qty Prepared Qty Sold Selling Price($)

--------------------------------------------------------------------- -----------

Computer [c1]DELL 0 0 1700
Computer [c2]Compaq 0 0 1200
Computer [c3]HP 0 0 1500
Printer [p1]Digitech 0 0 200
Printer [p2]HP 0 0 300
Scanner [s1]HP 0 0 150
Scanner [s2]Digitech 0 0 120
--------------------------------------------------------------------------- -----

[S]ales [D]aily Order [C]ollection [E]xit


>Option:


The User will select the 4 functions, that is, Sales, Daily Order, Collection and Exit.

This is the Main Sreen code :
Actually, i intend to call the function in the If/Else.
import java.io.*;
 
class Product {
	String category;
	String favourite;
	int qtyPrepared;
	int qtySold;
	int costPrice;
	int sellingPrice;
	int difference;
}
 
class MainScreen {
	public static void main(String[] args) throws IOException {
		Product c1 = new Product();
		Product c2 = new Product();
		Product c3 = new Product();
		Product p1 = new Product();
		Product p2 = new Product();
		Product s1 = new Product();
		Product s2 = new Product();
 
		c1.category = "Computer";
		c1.favourite = "[c1]DELL";
		c1.qtyPrepared = 0;
		c1.qtySold = 0;
		c1.costPrice = 1000;
		c1.sellingPrice = 1700;
		c1.difference = 0;
 
		c2.category = "Computer";
		c2.favourite = "[c2]Compaq";
		c2.qtyPrepared = 0;
		c2.qtySold = 0;
		c2.costPrice = 900;
		c2.sellingPrice = 1200;
		c2.difference = 0;
 
		c3.category = "Computer";
		c3.favourite = "[c3]HP";
		c3.qtyPrepared = 0;
		c3.qtySold = 0;
		c3.costPrice = 1200;
		c3.sellingPrice = 1500;
		c3.difference = 0;
 
		p1.category = "Printer";
		p1.favourite = "[p1]Digitech";
		p1.qtyPrepared = 0;
		p1.qtySold = 0;
		p1.costPrice = 150;
		p1.sellingPrice = 200;
		p1.difference = 0;
 
		p2.category = "Printer";
		p2.favourite = "[p2]HP";
		p2.qtyPrepared = 0;
		p2.qtySold = 0;
		p2.costPrice = 180;
		p2.sellingPrice = 300;
		p2.difference = 0;
 
		s1.category = "Scanner";
		s1.favourite = "[s1]HP";
		s1.qtyPrepared = 0;
		s1.qtySold = 0;
		s1.costPrice = 100;
		s1.sellingPrice = 150;
		s1.difference = 0;
 
		s2.category = "Scanner";
		s2.favourite = "[s2]Digitech";
		s2.qtyPrepared = 0;
		s2.qtySold = 0;
		s2.costPrice = 80;
		s2.sellingPrice = 120;
		s2.difference = 0;
 
        System.out.println("\n\n");
		System.out.println("\t\tComputerMart, Madanne Amanda Smith");
		System.out.println("\n");
		System.out.println("Category\tFavourite\tQty Prepared\tQty Sold\tSelling Price($)");
		System.out.println("--------------------------------------------------------------------------------");
		System.out.println(c1.category + "\t" + c1.favourite + "\t" + c1.qtyPrepared + "\t\t" + c1.qtySold + "\t\t" + c1.sellingPrice);
		System.out.println(c2.category + "\t" + c2.favourite + "\t" + c2.qtyPrepared + "\t\t" + c2.qtySold + "\t\t" + c2.sellingPrice);
		System.out.println(c3.category + "\t" + c3.favourite + "\t\t" + c3.qtyPrepared + "\t\t" + c3.qtySold + "\t\t" + c3.sellingPrice);
		System.out.println(p1.category + "\t\t" + p1.favourite + "\t" + p1.qtyPrepared + "\t\t" + p1.qtySold + "\t\t" + p1.sellingPrice);
		System.out.println(p2.category + "\t\t" + p2.favourite + "\t\t" + p2.qtyPrepared + "\t\t" + p2.qtySold + "\t\t" + p2.sellingPrice);
		System.out.println(s1.category + "\t\t" + s1.favourite + "\t\t" + s1.qtyPrepared + "\t\t" + s1.qtySold + "\t\t" + s1.sellingPrice);
		System.out.println(s2.category + "\t\t" + s2.favourite + "\t" + s2.qtyPrepared + "\t\t" + s2.qtySold + "\t\t" + s2.sellingPrice);
		System.out.println("--------------------------------------------------------------------------------");
	        System.out.println("[S]ales\t\t[D]aily Order\t\t[C]ollection\t\t[E]xit");
	        System.out.println("\n");
 
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader input = new BufferedReader(reader);
		System.out.print(">Option: ");
		String text = input.readLine();
		System.out.println("Your choice: " + text);
 
		if(text.equalsIgnoreCase("S"))
			System.out.println("Sales");
		else if (text.equalsIgnoreCase("D"))
			System.out.println("Daily Order");
		else if (text.equalsIgnoreCase("C"))
			System.out.println("Collection");
		else if (text.equalsIgnoreCase("E"))
			System.out.println("Exit");
		else
			System.out.println("Wrong option!");
 
 
	}
}
 

This is the Sales functions that using the above Product class:
import java.io.*;
class Sales {
	public static void main(String[] args) throws IOException{
		
		try
		{
			String prdCode ="";
			String prdQuantity = "0";
			String morePrd ="";
		
		
			InputStreamReader inReader = new InputStreamReader(System.in);
			BufferedReader BuffReader = new BufferedReader(inReader);
			System.out.println("Items sold:-");
			while(true)
			{
				System.out.print("Enter product code: ");
				prdCode = BuffReader.readLine();
				System.out.print("Enter quantity: ");
				prdQuantity = BuffReader.readLine();
				int prdQty = new Integer(prdQuantity).intValue();
 
				if(prdCode.equalsIgnoreCase("c1")){
					c1.qtyPrepared = c1.qtyPrepared - prdQty;	
					c1.qtySold = c1.qtySold + prdQty;
					System.out.println("Quantity prepared =" + c1.qtyPrepared);
					System.out.print("Quantity Sold =" + c1.qtySold);
				}
				else if (prdCode.equalsIgnoreCase("c2")){
					c2.qtyPrepared = c2.qtyPrepared - prdQty;	
					c2.qtySold = c2.qtySold + prdQty;
					System.out.println("Quantity prepared =" + c2.qtyPrepared);
					System.out.print("Quantity Sold =" + c2.qtySold);
				}
				else if (prdCode.equalsIgnoreCase("c3")){
					c3.qtyPrepared = c3.qtyPrepared - prdQty;	
					c3.qtySold = c3.qtySold + prdQty;
					System.out.println("Quantity prepared =" + c3.qtyPrepared);
					System.out.print("Quantity Sold =" + c3.qtySold);
				}
				else if (prdCode.equalsIgnoreCase("p1")){
					p1.qtyPrepared = p1.qtyPrepared - prdQty;	
					p1.qtySold = p1.qtySold + prdQty;
					System.out.println("Quantity prepared =" + p1.qtyPrepared);
					System.out.print("Quantity Sold =" + p1.qtySold);
				}
				else if (prdCode.equalsIgnoreCase("p2")){
					p1.qtyPrepared = p2.qtyPrepared - prdQty;	
					p1.qtySold = p2.qtySold + prdQty;
					System.out.println("Quantity prepared =" + p2.qtyPrepared);
					System.out.print("Quantity Sold =" + p2.qtySold);
				}
				else if (prdCode.equalsIgnoreCase("s1")){
					s1.qtyPrepared = s1.qtyPrepared - prdQty;	
					s1.qtySold = s1.qtySold + prdQty;
					System.out.println("Quantity prepared =" + s1.qtyPrepared);
					System.out.print("Quantity Sold =" + s1.qtySold);
				}
				else if (prdCode.equalsIgnoreCase("s2")){
					s2.qtyPrepared = s2.qtyPrepared - prdQty;	
					s2.qtySold = s2.qtySold + prdQty;
					System.out.println("Quantity prepared =" + s2.qtyPrepared);
					System.out.print("Quantity Sold =" + s2.qtySold);
				}
				else
					System.out.println("Wrong option!");
				
				
				System.out.print("More items[Y/N]?:");
				morePrd = BuffReader.readLine();
				if(morePrd.equalsIgnoreCase("N"))
			 		break;
				else
			 		continue;
			
			}
		}
		catch(Exception e )
		{
			System.out.println("ERROR " + e);
		}
	}
}


This is the Daily Order functions that using the above Product class:
import java.io.*;
 
class DailyOrder {
	public static void main(String[] args) throws IOException{
		try
		{
			String prdCode ="";
			String prdQuantity = "0";
			String morePrd ="";
		
		
			InputStreamReader inReader = new InputStreamReader(System.in);
			BufferedReader BuffReader = new BufferedReader(inReader);
			System.out.println("Items ordered:-");
			while(true)
			{
				System.out.print("Enter product code: ");
				prdCode = BuffReader.readLine();
				System.out.print("Enter quantity: ");
				prdQuantity = BuffReader.readLine();
				int prdQty = new Integer(prdQuantity).intValue();
 
				if(prdCode.equalsIgnoreCase("c1")){
					c1.qtyPrepared = c1.qtyPrepared + prdQty;	
					System.out.println("Quantity prepared =" + c1.qtyPrepared);
				}
				else if (prdCode.equalsIgnoreCase("c2")){
					c2.qtyPrepared = c2.qtyPrepared + prdQty;	
					System.out.println("Quantity prepared =" + c2.qtyPrepared);
				}
				else if (prdCode.equalsIgnoreCase("c3")){
					c3.qtyPrepared = c3.qtyPrepared + prdQty;	
					System.out.println("Quantity prepared =" + c3.qtyPrepared);
				}
				else if (prdCode.equalsIgnoreCase("p1")){
					p1.qtyPrepared = p1.qtyPrepared + prdQty;	
					System.out.println("Quantity prepared =" + p1.qtyPrepared);
				}
				else if (prdCode.equalsIgnoreCase("p2")){
					p1.qtyPrepared = p2.qtyPrepared + prdQty;	
					System.out.println("Quantity prepared =" + p2.qtyPrepared);
				}
				else if (prdCode.equalsIgnoreCase("s1")){
					s1.qtyPrepared = s1.qtyPrepared + prdQty;	
					System.out.println("Quantity prepared =" + s1.qtyPrepared);
				}
				else if (prdCode.equalsIgnoreCase("s2")){
					s2.qtyPrepared = s2.qtyPrepared + prdQty;	
					System.out.println("Quantity prepared =" + s2.qtyPrepared);
				}
				else
					System.out.println("Wrong Product Code Entered!!!");
				
				
				System.out.print("More items[Y/N]?:");
				morePrd = BuffReader.readLine();
				if(morePrd.equalsIgnoreCase("N"))
			 		break;
				else
			 		continue;
			
			}
		}
		catch(Exception e )
		{
			System.out.println("ERROR " + e);
		}
	}
}



This is the Collection functions that using the above Product class:
import java.io.*;
 
class Collection {
	public static void main(String[] args) {
		int sumTotalCostPrice = c1.totalCostPrice + c2.totalCostPrice + c3.totalCostPrice + p1.totalCostPrice + p2.totalCostPrice + s1.totalCostPrice + s2.totalCostPrice;		
		int sumTotalSellingPrice = c1.totalSellingPrice + c2.totalSellingPrice + c3.totalSellingPrice + p1.totalSellingPrice + p2.totalSellingPrice + s1.totalSellingPrice + s2.totalSellingPrice;
		int sumDifference = sumTotalSellingPrice - sumTotalCostPrice;
 
        	System.out.println("\n\n");
		System.out.println("\t\tComputerMart, Madanne Amanda Smith");
		System.out.println("\t\t\tDaily Sales Collection");
		System.out.println("\n");
		System.out.println("\t\t\t\tQuantity\tTotal Price($)");
		System.out.println("Category\tFavourite   Prepared   Sold\tCost  Selling\tDifference($)");
		System.out.println("--------------------------------------------------------------------------------");
		System.out.println(c1.category + "\t" + c1.favourite + "\t" + c1.qtyPrepared + "\t" + c1.qtySold + "\t" + c1.totalCostPrice + "\t" + c1.totalSellingPrice + "\t\t" + c1.difference);
		System.out.println(c2.category + "\t" + c2.favourite + "\t" + c2.qtyPrepared + "\t" + c2.qtySold + "\t" + c2.totalCostPrice + "\t" + c2.totalSellingPrice + "\t\t" + c2.difference);
		System.out.println(c3.category + "\t" + c3.favourite + "\t\t" + c3.qtyPrepared + "\t" + c3.qtySold + "\t" + c3.totalCostPrice + "\t" + c3.totalSellingPrice + "\t\t" + c3.difference);
		System.out.println(p1.category + "\t\t" + p1.favourite + "\t" + p1.qtyPrepared + "\t" + p1.qtySold + "\t" + p1.totalCostPrice + "\t" + p1.totalSellingPrice + "\t\t" + p1.difference);
		System.out.println(p2.category + "\t\t" + p2.favourite + "\t\t" + p2.qtyPrepared + "\t" + p2.qtySold + "\t" + p2.totalCostPrice + "\t" + p2.totalSellingPrice + "\t\t" + p2.difference);
		System.out.println(s1.category + "\t\t" + s1.favourite + "\t\t" + s1.qtyPrepared + "\t" + s1.qtySold + "\t" + s1.totalCostPrice + "\t" + s1.totalSellingPrice + "\t\t" + s1.difference);
		System.out.println(s2.category + "\t\t" + s2.favourite + "\t" + s2.qtyPrepared + "\t" + s2.qtySold + "\t" + s2.totalCostPrice + "\t" + s2.totalSellingPrice + "\t\t" + s2.difference);
		System.out.println("--------------------------------------------------------------------------------");
        	System.out.println("Total" + "\t\t\t\t\t\t" + sumTotalCostPrice + "\t" + sumTotalSellingPrice + "\t\t" + sumDifference);
        	System.out.println("\n");
 
 
	}
}

Thanks a million....


twc

Posts: 129
Nickname: twc
Registered: Feb, 2004

Re: How to combine subfunction into Main Program Posted: Feb 28, 2004 3:56 PM
Reply to this message Reply
Since you have made a comment about meeting a deadline, I am assuming that you are doing this for a class. I don't mind helping you with a class project since you have obviously been working very hard on your own (as opposed to some students who seem to want someone to do their homework for them). But I am very concerned about how you have designed the program.

Your project doesn't follow OOP design at all. Is this is an example of how your teacher is showing you to design your programs? I hope not, since nobody who really knows Java would design this program in this fashion.

I can help you get your program working, but it will involve rewriting almost everything. The good news is that using OOP design will decrease the overall size of your program considerably.

If you just want to fix what you have, I'll let someone else help you. I can't bring myself to help you do something the wrong way. But if you want to do things the right way, let me know.

twc

leonglkw

Posts: 43
Nickname: leonglkw
Registered: Feb, 2004

Re: How to combine subfunction into Main Program Posted: Feb 29, 2004 2:01 AM
Reply to this message Reply
Hi TWC,

Actually, I'm just a beginner of Java.
In the previous codes that i tried is based on what i know.
If u can help me to rewrite in OOP design, it would be most appreciated.

I just left 12 hours for the deadline.

Thanks a million.

twc

Posts: 129
Nickname: twc
Registered: Feb, 2004

Re: How to combine subfunction into Main Program Posted: Feb 29, 2004 8:12 AM
Reply to this message Reply
I think it will take less time to rewrite in OOP form than to fix what you have, so I'm posting some suggestions further down. But to fix it in 12 hours, when we aren't corresponding in real time, that may not be possible. You may not have any choice but to ignore my advice and turn in what you have.

Another issue that you need to consider is that if this is what your instructor is teaching you, he/she may be expecting something that looks like what you produced. That might mean that your instructor does not understand OOP design, or it may mean that he/she is trying to teach other concepts first and will introduce OOP-design later. While I believe that you should learn OOP-design as you learn the other concepts, there are teachers who prefer to keep them separate.

Also, I need to make it clear that I'm not going to write all of the code for you. But I will do my best to help you write it yourself. It would help if I knew what your final result needed to be. I'm going to start with some suggestions on how to proceed based on what I can see from your various posts. In the meantime, please post what the final requirements are.

Suggestions
1. Don't delete your old stuff, but I would create a new folder and start the project over in it. Create two files, one called Project.java and the other MainDisplay.java. Put the code that I posted to you in Re: How to Convert Class Variable to Array in the respective classes. That will give you a start.

2. As Adam Duffy advised you, in OOP you want the class to do most of the work. We are going to move most of your code out of the MainDisplay class and into the Product class.

3. Instance variables should almost always be private so their values can't be changed unless you allow them to be. So you need methods to access them (called accessor methods), and might need methods to change them (called mutator methods) depending on the requirements of your project. The following are examples of accessor methods. You probably want one for each of your instance variables. Note that the return type (the word after public) must match the type of data being accessed.
public String getCategory(){
  return category;
}
 
public int getTotalSellingPrice(){
  return totalSellingPrice;
}

You may have noticed that I put the formula for calculating totalSellingPrice in the Constructor, whereas Adam Duffy put it in the accessor method, but both of us put it in the Product class instead of the MainDisplay class. The difference between Adam's approach and mine is just personal preference, but the difference between our designs and what you have been doing is the difference between OOP and non-OOP design.

4. Based on your most recent post, the code that I gave you for the MainDisplay class probably only needs one array, instead of three - especially if you are going to fill the array from a disk file. Below is a partial replacement for the code that I gave you. I changed the name of the array for clarity.
Product[] inventory = new Product[7];
//this will probably get replaced by code to get the data from the disk, but use it for now.
inventory[0] = new Product("Computer", "DELL", 0, 0, 1000, 1700);
//and so on... until
inventory[6] = new Product("Scanner", "Digitech", 0, 0, 80, 120); 


5. Your old output won't work anymore. I've modified some of the code that I copied out of your post to show how to get the same output with the changes that I've suggested. Note the method names that I used. Those are the accessor methods that you need to create.
System.out.println("\n\n");
System.out.println("\t\tComputerMart, Madanne Amanda Smith");
System.out.println("\n");
System.out.println("Category\tFavourite\tQty Prepared\tQty Sold\tSelling Price($)");
System.out.println("--------------------------------------------------------------------------------");
for(int j = 0; j < inventory.length; j++){
  System.out.println(inventory[j].getCategory() + "\t" + inventory[j].getFavourite() + "\t" + inventory[j].getQuantityPrepared() + "\t\t" + inventory[j].getQuantitySold() + "\t\t" + inventory[j].getSellingPrice());
}//NOTE:  I usually use i as my counting variable, but the Artima system interprets it as a request to print italics, so I switched to j.
System.out.println("--------------------------------------------------------------------------------");
System.out.println("[S]ales\t\t[D]aily Order\t\t[C]ollection\t\t[E]xit");
System.out.println("\n");
// code to enter selection and if/else tree goes here.


Without knowing what the requirements of the program are, I'm not sure what you need to do next. I'll check again later to see what you post.

twc

leonglkw

Posts: 43
Nickname: leonglkw
Registered: Feb, 2004

Re: How to combine subfunction into Main Program Posted: Feb 29, 2004 8:28 AM
Reply to this message Reply
Thanks TWC.
In fact, what my instructor want is OOP design.
Due to my lack of OOP knowledge, i just can produce something like writing the C codes.

The requirement is the Sales, Daily Order, Collection and Exit function they need to work.

The data in the class variable such as the qtySold and qtyPrepared need to be read/write from a I/O file.

That's the most important points.

Thank for your help.

My deadline is 01 March 2004 Before 11.59 PM.

leonglkw

Posts: 43
Nickname: leonglkw
Registered: Feb, 2004

Re: How to combine subfunction into Main Program Posted: Feb 29, 2004 9:29 AM
Reply to this message Reply
Hi TWC,

This is the code that works but is not designed in OOP way.
Is there any ways to modify to be OOP and the data is read/write from the I/O file instead of during run time.

import java.io.*;
 
class Product {
	String[] category;
	String[] favourite;
	int[] qtyPrepared;
	int[] qtySold;
	int[] costPrice;
	int[] sellingPrice;
	int[] totalSellingPrice;
	int[] totalCostPrice;
	int[] difference;
	
	
}
 
 
class ComputerMart {
	public static void main(String[] args) throws IOException{
 
 
	// Declare computer product array and allocate storage
	String[] category = { "Computer", "Printer", "Scanner" };
	String[] favourite = { "[c1]DELL", "[c2]Compaq", "[c3]HP", "[p1]Digitech", "[p2]HP", "[s1]HP", "[s2]Digitech" };
	int[] qtyPrepared = { 2, 4, 2, 20, 20, 100, 100 };
	int[] qtySold = { 0, 0, 0, 0, 0, 0, 0 };
	int[] costPrice = { 1000, 900, 1200, 150, 180, 100, 80 };
	int[] sellingPrice = { 1700, 1200, 1500, 200, 300, 150, 120 };
	int[] totalSellingPrice = { 0, 0, 0, 0, 0, 0, 0 };
	int[] totalCostPrice = { 0, 0, 0, 0, 0, 0, 0 };
	int[] difference = { 0, 0, 0, 0, 0, 0, 0 };
 
	while(true){
	// Display the main screen
	System.out.println("\n\n");
	System.out.println("\t\tComputerMart, Madanne Amanda Smith");
	System.out.println("\n");
	System.out.println("Category\tFavourite\tQty Prepared\tQty Sold\tSelling Price($)");
	System.out.println("--------------------------------------------------------------------------------");
	System.out.println( category[0] + "\t" + favourite[0] + "\t" + qtyPrepared[0] + "\t\t" + qtySold[0] + "\t\t" + sellingPrice[0]);
	System.out.println( category[0] + "\t" + favourite[1] + "\t" + qtyPrepared[1] + "\t\t" + qtySold[1] + "\t\t" + sellingPrice[1]);
	System.out.println( category[0] + "\t" + favourite[2] + "\t\t" + qtyPrepared[2] + "\t\t" + qtySold[2] + "\t\t" + sellingPrice[2]);
	System.out.println( category[1] + "\t\t" + favourite[3] + "\t" + qtyPrepared[3] + "\t\t" + qtySold[3] + "\t\t" + sellingPrice[3]);
	System.out.println( category[1] + "\t\t" + favourite[4] + "\t\t" + qtyPrepared[4] + "\t\t" + qtySold[4] + "\t\t" + sellingPrice[4]);
	System.out.println( category[2] + "\t\t" + favourite[5] + "\t\t" + qtyPrepared[5] + "\t\t" + qtySold[5] + "\t\t" + sellingPrice[5]);
	System.out.println( category[2] + "\t\t" + favourite[6] + "\t" + qtyPrepared[6] + "\t\t" + qtySold[6] + "\t\t" + sellingPrice[6]);
	System.out.println("--------------------------------------------------------------------------------");
        System.out.println("[S]ales\t\t[D]aily Order\t\t[C]ollection\t\t[E]xit");
        System.out.println("\n");
 
	
	
	// Get user input to make option of Sales function, Daily Order function, Collection function and Exit function
	InputStreamReader reader = new InputStreamReader(System.in);
	BufferedReader input = new BufferedReader(reader);
	System.out.print(">Option: ");
	String text = input.readLine();
	System.out.println("Your choice: " + text);
	
	
 
	if(text.equalsIgnoreCase("S")){
		System.out.println("Sales");
 
		try
		{
			String prdCode ="";
			String prdQuantity = "0";
			String morePrd ="";
		
		
			
			while(true)
			{
				InputStreamReader inReader = new InputStreamReader(System.in);
				BufferedReader BuffReader = new BufferedReader(inReader);
				System.out.println("Items sold:-");
				System.out.print("Enter product code: ");
				prdCode = BuffReader.readLine();
				System.out.print("Enter quantity: ");
				prdQuantity = BuffReader.readLine();
				int prdQty = new Integer(prdQuantity).intValue();
 
				
				if(prdCode.equalsIgnoreCase("c1") && qtyPrepared[0] >= prdQty){
					qtyPrepared[0] = qtyPrepared[0] - prdQty;	
					qtySold[0] = qtySold[0] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[0]);
					System.out.print("Quantity Sold =" + qtySold[0]);
				}
				else if (prdCode.equalsIgnoreCase("c2") && qtyPrepared[1] >= prdQty){
					qtyPrepared[1] = qtyPrepared[1] - prdQty;	
					qtySold[1] = qtySold[1] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[1]);
					System.out.print("Quantity Sold =" + qtySold[1]);
				}
				else if (prdCode.equalsIgnoreCase("c3") && qtyPrepared[2] >= prdQty){
					qtyPrepared[2] = qtyPrepared[2] - prdQty;	
					qtySold[2] = qtySold[2] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[2]);
					System.out.print("Quantity Sold =" + qtySold[2]);
				}
				else if (prdCode.equalsIgnoreCase("p1") && qtyPrepared[3] >= prdQty){
					qtyPrepared[3] = qtyPrepared[3] - prdQty;	
					qtySold[3] = qtySold[3] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[3]);
					System.out.print("Quantity Sold =" + qtySold[3]);
				}
				else if (prdCode.equalsIgnoreCase("p2") && qtyPrepared[4] >= prdQty){
					qtyPrepared[4] = qtyPrepared[4] - prdQty;	
					qtySold[4] = qtySold[4] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[4]);
					System.out.print("Quantity Sold =" + qtySold[4]);
				}
				else if (prdCode.equalsIgnoreCase("s1") && qtyPrepared[5] >= prdQty){
					qtyPrepared[5] = qtyPrepared[5] - prdQty;	
					qtySold[5] = qtySold[5] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[5]);
					System.out.print("Quantity Sold =" + qtySold[5]);
				}
				else if (prdCode.equalsIgnoreCase("s2") && qtyPrepared[6] >= prdQty){
					qtyPrepared[6] = qtyPrepared[6] - prdQty;	
					qtySold[6] = qtySold[6] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[6]);
					System.out.print("Quantity Sold =" + qtySold[6]);
				}
				else
					System.out.println("Insufficient Qty.-Please come again");
 
					
				System.out.print("\n");
 
				System.out.print("More items[Y/N]?:");
				morePrd = BuffReader.readLine();
				if(morePrd.equalsIgnoreCase("N")){
					System.out.println("\n");
			 		System.out.println(">Press any key to continue");
					break;
				}
				else
			 		continue;
				
				
			
			}
		}
		catch(Exception e )
		{
			System.out.println("ERROR " + e);
		}
 
	}
	else if (text.equalsIgnoreCase("D")){
		System.out.println("Daily Order");
		
		try
		{
			String prdCode ="";
			String prdQuantity = "0";
			String morePrd ="";
		
		
			InputStreamReader inReader = new InputStreamReader(System.in);
			BufferedReader BuffReader = new BufferedReader(inReader);
			System.out.println("Items ordered:-");
			while(true)
			{
				System.out.print("Enter product code: ");
				prdCode = BuffReader.readLine();
				System.out.print("Enter quantity: ");
				prdQuantity = BuffReader.readLine();
				int prdQty = new Integer(prdQuantity).intValue();
 
				if((prdCode.equalsIgnoreCase("c1")||prdCode.equalsIgnoreCase("c2")||prdCode.equalsIgnoreCase("c3")) && prdQty <= 1)
					System.out.println("Minimum qty requirement not met!!!");
 
				if(prdCode.equalsIgnoreCase("c1")){
					qtyPrepared[0] = qtyPrepared[0] + prdQty;	
					System.out.println("Quantity prepared =" + qtyPrepared[0]);
				}
				else if (prdCode.equalsIgnoreCase("c2")){
					qtyPrepared[1] = qtyPrepared[1] + prdQty;	
					System.out.println("Quantity prepared =" + qtyPrepared[1]);
				}
				else if (prdCode.equalsIgnoreCase("c3")){
					qtyPrepared[2] = qtyPrepared[2] + prdQty;	
					System.out.println("Quantity prepared =" + qtyPrepared[2]);
				}
				else if (prdCode.equalsIgnoreCase("p1")){
					qtyPrepared[3] = qtyPrepared[3] + prdQty;	
					System.out.println("Quantity prepared =" + qtyPrepared[3]);
				}
				else if (prdCode.equalsIgnoreCase("p2")){
					qtyPrepared[4] = qtyPrepared[4] + prdQty;	
					System.out.println("Quantity prepared =" + qtyPrepared[4]);
				}
				else if (prdCode.equalsIgnoreCase("s1")){
					qtyPrepared[5] = qtyPrepared[5] + prdQty;	
					System.out.println("Quantity prepared =" + qtyPrepared[5]);
				}
				else if (prdCode.equalsIgnoreCase("s2")){
					qtyPrepared[6] = qtyPrepared[6] + prdQty;	
					System.out.println("Quantity prepared =" + qtyPrepared[6]);
				}
				else
					System.out.println("Wrong Product Code Entered!!!");
				
				
				System.out.print("More items[Y/N]?:");
				morePrd = BuffReader.readLine();
				if(morePrd.equalsIgnoreCase("N"))
			 		break;
				else
			 		continue;
			
			}
		}
		catch(Exception e )
		{
			System.out.println("ERROR " + e);
		}		
	}
	else if (text.equalsIgnoreCase("C")){
		
				
		int sumTotalCostPrice = totalCostPrice[0] + totalCostPrice[1] + totalCostPrice[2] + totalCostPrice[3] + totalCostPrice[4] + totalCostPrice[5] + totalCostPrice[6];		
		int sumTotalSellingPrice = totalSellingPrice[0] + totalSellingPrice[1] + totalSellingPrice[2] + totalSellingPrice[3] + totalSellingPrice[4] + totalSellingPrice[5] + totalSellingPrice[6];
		int sumDifference = sumTotalSellingPrice - sumTotalCostPrice;
 
		totalCostPrice[0] = qtyPrepared[0] * costPrice[0];
		totalCostPrice[1] = qtyPrepared[1] * costPrice[1];
		totalCostPrice[2] = qtyPrepared[2] * costPrice[2];
		totalCostPrice[3] = qtyPrepared[3] * costPrice[3];
		totalCostPrice[4] = qtyPrepared[4] * costPrice[4];
		totalCostPrice[5] = qtyPrepared[5] * costPrice[5];
		totalCostPrice[6] = qtyPrepared[6] * costPrice[6];
 
		totalSellingPrice[0] = qtySold[0] * sellingPrice[0];
		totalSellingPrice[1] = qtySold[1] * sellingPrice[1];
		totalSellingPrice[2] = qtySold[2] * sellingPrice[2];
		totalSellingPrice[3] = qtySold[3] * sellingPrice[3];
		totalSellingPrice[4] = qtySold[4] * sellingPrice[4];
		totalSellingPrice[5] = qtySold[5] * sellingPrice[5];
		totalSellingPrice[6] = qtySold[6] * sellingPrice[6];
 
		difference[0] = totalSellingPrice[0] - totalCostPrice[0];
		difference[1] = totalSellingPrice[1] - totalCostPrice[1];
		difference[2] = totalSellingPrice[2] - totalCostPrice[2];
		difference[3] = totalSellingPrice[3] - totalCostPrice[3];
		difference[4] = totalSellingPrice[4] - totalCostPrice[4];
		difference[5] = totalSellingPrice[5] - totalCostPrice[5];
		difference[6] = totalSellingPrice[6] - totalCostPrice[6];
 
        	System.out.println("\n\n");
		System.out.println("\t\tComputerMart, Madanne Amanda Smith");
		System.out.println("\t\t\tDaily Sales Collection");
		System.out.println("\n");
		System.out.println("\t\t\t\tQuantity\tTotal Price($)");
		System.out.println("Category\tFavourite   Prepared   Sold\tCost  Selling\tDifference($)");
		System.out.println("--------------------------------------------------------------------------------");
		System.out.println(category[0] + "\t" + favourite[0] + "\t" + qtyPrepared[0] + "\t" + qtySold[0] + "\t" + totalCostPrice[0] + "\t" + totalSellingPrice[0] + "\t" + difference[0]);
		System.out.println(category[0] + "\t" + favourite[1] + "\t" + qtyPrepared[1] + "\t" + qtySold[1] + "\t" + totalCostPrice[1] + "\t" + totalSellingPrice[1] + "\t" + difference[1]);
		System.out.println(category[0] + "\t" + favourite[2] + "\t\t" + qtyPrepared[2] + "\t" + qtySold[2] + "\t" + totalCostPrice[2] + "\t" + totalSellingPrice[2] + "\t" + difference[2]);
		System.out.println(category[1] + "\t\t" + favourite[3] + "\t" + qtyPrepared[3] + "\t" + qtySold[3] + "\t" + totalCostPrice[3] + "\t" + totalSellingPrice[3] + "\t" + difference[3]);
		System.out.println(category[1] + "\t\t" + favourite[4] + "\t\t" + qtyPrepared[4] + "\t" + qtySold[4] + "\t" + totalCostPrice[4] + "\t" + totalSellingPrice[4] + "\t" + difference[4]);
		System.out.println(category[2] + "\t\t" + favourite[5] + "\t\t" + qtyPrepared[5] + "\t" + qtySold[5] + "\t" + totalCostPrice[5] + "\t" + totalSellingPrice[5] + "\t" + difference[5]);
		System.out.println(category[2] + "\t\t" + favourite[6] + "\t" + qtyPrepared[6] + "\t" + qtySold[6] + "\t" + totalCostPrice[6] + "\t" + totalSellingPrice[6] + "\t" + difference[6]);
		System.out.println("--------------------------------------------------------------------------------");
        	System.out.println("Total" + "\t\t\t\t\t\t" + sumTotalCostPrice + "\t" + sumTotalSellingPrice + "\t" + sumDifference);
        	System.out.println("\n");
		System.out.println(">Press any key to continue");
	}
	else if (text.equalsIgnoreCase("E")){
		System.out.println("Exit");
		System.exit(0);
	}
	else
		System.out.println("Invalid Option!");
	
	String moreTransaction = input.readLine();
	if(moreTransaction.equalsIgnoreCase("N"))
			 break;
			else
			 continue;
	}
			
 
	
 
	
	
	}
}


thank you.

I still have about 8 hrs to meet the deadline.

leonglkw

Posts: 43
Nickname: leonglkw
Registered: Feb, 2004

Re: How to combine subfunction into Main Program Posted: Feb 29, 2004 9:56 AM
Reply to this message Reply
Hi TWC,

Pls ignore the previous codes this is the correct one.

import java.io.*;
 
class Product {
	String[] category;
	String[] favourite;
	int[] qtyPrepared;
	int[] qtySold;
	int[] costPrice;
	int[] sellingPrice;
	int[] totalSellingPrice;
	int[] totalCostPrice;
	int[] difference;
	
	
}
 
 
class ComputerMart {
	public static void main(String[] args) throws IOException{
 
 
	// Declare computer product array and allocate storage
	String[] category = { "Computer", "Printer", "Scanner" };
	String[] favourite = { "[c1]DELL", "[c2]Compaq", "[c3]HP", "[p1]Digitech", "[p2]HP", "[s1]HP", "[s2]Digitech" };
	int[] qtyPrepared = { 50, 50, 50, 60, 60, 70, 70 };
	int[] qtySold = { 0, 0, 0, 0, 0, 0, 0 };
	int[] costPrice = { 1000, 900, 1200, 150, 180, 100, 80 };
	int[] sellingPrice = { 1700, 1200, 1500, 200, 300, 150, 120 };
	int[] totalSellingPrice = { 0, 0, 0, 0, 0, 0, 0 };
	int[] totalCostPrice = { 0, 0, 0, 0, 0, 0, 0 };
	int[] difference = { 0, 0, 0, 0, 0, 0, 0 };
 
	while(true){
	// Display the main screen
	System.out.println("\n\n");
	System.out.println("\t\tComputerMart, Madanne Amanda Smith");
	System.out.println("\n");
	System.out.println("Category\tFavourite\tQty Prepared\tQty Sold\tSelling Price($)");
	System.out.println("--------------------------------------------------------------------------------");
	System.out.println( category[0] + "\t" + favourite[0] + "\t" + qtyPrepared[0] + "\t\t" + qtySold[0] + "\t\t" + sellingPrice[0]);
	System.out.println( category[0] + "\t" + favourite[1] + "\t" + qtyPrepared[1] + "\t\t" + qtySold[1] + "\t\t" + sellingPrice[1]);
	System.out.println( category[0] + "\t" + favourite[2] + "\t\t" + qtyPrepared[2] + "\t\t" + qtySold[2] + "\t\t" + sellingPrice[2]);
	System.out.println( category[1] + "\t\t" + favourite[3] + "\t" + qtyPrepared[3] + "\t\t" + qtySold[3] + "\t\t" + sellingPrice[3]);
	System.out.println( category[1] + "\t\t" + favourite[4] + "\t\t" + qtyPrepared[4] + "\t\t" + qtySold[4] + "\t\t" + sellingPrice[4]);
	System.out.println( category[2] + "\t\t" + favourite[5] + "\t\t" + qtyPrepared[5] + "\t\t" + qtySold[5] + "\t\t" + sellingPrice[5]);
	System.out.println( category[2] + "\t\t" + favourite[6] + "\t" + qtyPrepared[6] + "\t\t" + qtySold[6] + "\t\t" + sellingPrice[6]);
	System.out.println("--------------------------------------------------------------------------------");
        System.out.println("[S]ales\t\t[D]aily Order\t\t[C]ollection\t\t[E]xit");
        System.out.println("\n");
 
	
	
	// Get user input to make option of Sales function, Daily Order function, Collection function and Exit function
	InputStreamReader reader = new InputStreamReader(System.in);
	BufferedReader input = new BufferedReader(reader);
	System.out.print(">Option: ");
	String text = input.readLine();
	System.out.println("Your choice: " + text);
	
	
 
	if(text.equalsIgnoreCase("S")){
		System.out.println("Sales");
 
		try
		{
			String prdCode ="";
			String prdQuantity = "0";
			String morePrd ="";
		
		
			InputStreamReader inReader = new InputStreamReader(System.in);
			BufferedReader BuffReader = new BufferedReader(inReader);
			System.out.println("Items sold:-");
			while(true)
			{
				System.out.print("Enter product code: ");
				prdCode = BuffReader.readLine();
				System.out.print("Enter quantity: ");
				prdQuantity = BuffReader.readLine();
				int prdQty = new Integer(prdQuantity).intValue();
 
				if(prdCode.equalsIgnoreCase("c1")){
					qtyPrepared[0] = qtyPrepared[0] - prdQty;	
					qtySold[0] = qtySold[0] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[0]);
					System.out.print("Quantity Sold =" + qtySold[0]);
				}
				else if (prdCode.equalsIgnoreCase("c2")){
					qtyPrepared[1] = qtyPrepared[1] - prdQty;	
					qtySold[1] = qtySold[1] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[1]);
					System.out.print("Quantity Sold =" + qtySold[1]);
				}
				else if (prdCode.equalsIgnoreCase("c3")){
					qtyPrepared[2] = qtyPrepared[2] - prdQty;	
					qtySold[2] = qtySold[2] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[2]);
					System.out.print("Quantity Sold =" + qtySold[2]);
				}
				else if (prdCode.equalsIgnoreCase("p1")){
					qtyPrepared[3] = qtyPrepared[3] - prdQty;	
					qtySold[3] = qtySold[3] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[3]);
					System.out.print("Quantity Sold =" + qtySold[3]);
				}
				else if (prdCode.equalsIgnoreCase("p2")){
					qtyPrepared[4] = qtyPrepared[4] - prdQty;	
					qtySold[4] = qtySold[4] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[4]);
					System.out.print("Quantity Sold =" + qtySold[4]);
				}
				else if (prdCode.equalsIgnoreCase("s1")){
					qtyPrepared[5] = qtyPrepared[5] - prdQty;	
					qtySold[5] = qtySold[5] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[5]);
					System.out.print("Quantity Sold =" + qtySold[5]);
				}
				else if (prdCode.equalsIgnoreCase("s2")){
					qtyPrepared[6] = qtyPrepared[6] - prdQty;	
					qtySold[6] = qtySold[6] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[6]);
					System.out.print("Quantity Sold =" + qtySold[6]);
				}
				else
					System.out.println("Wrong option!");
				
				System.out.print("\n");
				System.out.print("More items[Y/N]?:");
				morePrd = BuffReader.readLine();
				if(morePrd.equalsIgnoreCase("N")){
					System.out.println("\n");
			 		System.out.println(">Press any key to continue");
					break;
				}
				else
			 		continue;
				
				
			
			}
		}
		catch(Exception e )
		{
			System.out.println("ERROR " + e);
		}
 
	}
	else if (text.equalsIgnoreCase("D")){
		System.out.println("Daily Order");
		
		try
		{
			String prdCode ="";
			String prdQuantity = "0";
			String morePrd ="";
		
		
			InputStreamReader inReader = new InputStreamReader(System.in);
			BufferedReader BuffReader = new BufferedReader(inReader);
			System.out.println("Items ordered:-");
			while(true)
			{
				System.out.print("Enter product code: ");
				prdCode = BuffReader.readLine();
				System.out.print("Enter quantity: ");
				prdQuantity = BuffReader.readLine();
				int prdQty = new Integer(prdQuantity).intValue();
 
				
				if (prdCode.equalsIgnoreCase("c1") && prdQty > 1 ){
					qtyPrepared[0] = qtyPrepared[0] - prdQty;	
					qtySold[0] = qtySold[0] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[0]);
					System.out.print("Quantity Sold =" + qtySold[0]);
				}
				else if (prdCode.equalsIgnoreCase("c2") && prdQty > 1){
					qtyPrepared[1] = qtyPrepared[1] - prdQty;	
					qtySold[1] = qtySold[1] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[1]);
					System.out.print("Quantity Sold =" + qtySold[1]);
				}
				else if (prdCode.equalsIgnoreCase("c3") && prdQty > 1){
					qtyPrepared[2] = qtyPrepared[2] - prdQty;	
					qtySold[2] = qtySold[2] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[2]);
					System.out.print("Quantity Sold =" + qtySold[2]);
				}
				else if (prdCode.equalsIgnoreCase("p1") && prdQty > 10){
					qtyPrepared[3] = qtyPrepared[3] - prdQty;	
					qtySold[3] = qtySold[3] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[3]);
					System.out.print("Quantity Sold =" + qtySold[3]);
				}
				else if (prdCode.equalsIgnoreCase("p2") && prdQty > 10){
					qtyPrepared[4] = qtyPrepared[4] - prdQty;	
					qtySold[4] = qtySold[4] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[4]);
					System.out.print("Quantity Sold =" + qtySold[4]);
				}
				else if (prdCode.equalsIgnoreCase("s1") && prdQty > 20){
					qtyPrepared[5] = qtyPrepared[5] - prdQty;	
					qtySold[5] = qtySold[5] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[5]);
					System.out.print("Quantity Sold =" + qtySold[5]);
				}
				else if (prdCode.equalsIgnoreCase("s2") && prdQty > 20){
					qtyPrepared[6] = qtyPrepared[6] - prdQty;	
					qtySold[6] = qtySold[6] + prdQty;
					System.out.println("Quantity prepared =" + qtyPrepared[6]);
					System.out.print("Quantity Sold =" + qtySold[6]);
				}
				else
					System.out.println("Minimum qty not met!");
				
				System.out.print("\n");
				System.out.print("More items[Y/N]?:");
				morePrd = BuffReader.readLine();
				if(morePrd.equalsIgnoreCase("N")){
					System.out.println(">Press any key to continue");
			 		break;
				}
				else
			 		continue;
			
			}
		}
		catch(Exception e )
		{
			System.out.println("ERROR " + e);
		}		
	}
	else if (text.equalsIgnoreCase("C")){
		System.out.println("Collection");
		
		int sumTotalCostPrice = totalCostPrice[0] + totalCostPrice[1] + totalCostPrice[2] + totalCostPrice[3] + totalCostPrice[4] + totalCostPrice[5] + totalCostPrice[6];		
		int sumTotalSellingPrice = totalSellingPrice[0] + totalSellingPrice[1] + totalSellingPrice[2] + totalSellingPrice[3] + totalSellingPrice[4] + totalSellingPrice[5] + totalSellingPrice[6];
		int sumDifference = sumTotalSellingPrice - sumTotalCostPrice;
 
        	System.out.println("\n\n");
		System.out.println("\t\tComputerMart, Madanne Amanda Smith");
		System.out.println("\t\t\tDaily Sales Collection");
		System.out.println("\n");
		System.out.println("\t\t\t\tQuantity\tTotal Price($)");
		System.out.println("Category\tFavourite   Prepared   Sold\tCost  Selling\tDifference($)");
		System.out.println("--------------------------------------------------------------------------------");
		System.out.println(category[0] + "\t" + favourite[0] + "\t" + qtyPrepared[0] + "\t" + qtySold[0] + "\t" + totalCostPrice[0] + "\t" + totalSellingPrice[0] + "\t" + difference[0]);
		System.out.println(category[0] + "\t" + favourite[1] + "\t" + qtyPrepared[1] + "\t" + qtySold[1] + "\t" + totalCostPrice[1] + "\t" + totalSellingPrice[1] + "\t" + difference[1]);
		System.out.println(category[0] + "\t" + favourite[2] + "\t\t" + qtyPrepared[2] + "\t" + qtySold[2] + "\t" + totalCostPrice[2] + "\t" + totalSellingPrice[2] + "\t" + difference[2]);
		System.out.println(category[1] + "\t\t" + favourite[3] + "\t" + qtyPrepared[3] + "\t" + qtySold[3] + "\t" + totalCostPrice[3] + "\t" + totalSellingPrice[3] + "\t" + difference[3]);
		System.out.println(category[1] + "\t\t" + favourite[4] + "\t\t" + qtyPrepared[4] + "\t" + qtySold[4] + "\t" + totalCostPrice[4] + "\t" + totalSellingPrice[4] + "\t" + difference[4]);
		System.out.println(category[2] + "\t\t" + favourite[5] + "\t\t" + qtyPrepared[5] + "\t" + qtySold[5] + "\t" + totalCostPrice[5] + "\t" + totalSellingPrice[5] + "\t" + difference[5]);
		System.out.println(category[2] + "\t\t" + favourite[6] + "\t" + qtyPrepared[6] + "\t" + qtySold[6] + "\t" + totalCostPrice[6] + "\t" + totalSellingPrice[6] + "\t" + difference[6]);
		System.out.println("--------------------------------------------------------------------------------");
        	System.out.println("Total" + "\t\t\t\t\t\t" + sumTotalCostPrice + "\t" + sumTotalSellingPrice + "\t" + sumDifference);
        	System.out.println("\n");
		System.out.println(">Press any key to continue");
	}
	else if (text.equalsIgnoreCase("E")){
		System.out.println("Exit");
		System.exit(0);
	}
	else
		System.out.println("Invalid Option!");
	
	String moreTransaction = input.readLine();
	if(moreTransaction.equalsIgnoreCase("N"))
			 break;
			else
			 continue;
	}
			
 
	
 
	
	
	}
}


Thanks....

Flat View: This topic has 6 replies on 1 page
Topic: How to Convert Class Variable to Array Previous Topic   Next Topic Topic: Tomcat 4 --> IIS ?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use