⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.java

📁 电子商店
💻 JAVA
字号:
package product;
/**
 * @author 韦建艺 0658025
 * @2008.11.04
 * @
 */
import java.io.*;

public class Search {// KO!!!

	public void Sesrch(String str[][], double arr1[][], int arr2[][]) {
		// ID, Str, Double, Int
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		for (int k = 0; k < 10; k++) {
			System.out.println("Searching for a product from");
			System.out.println("Cin C: computer");
			System.out.println("Cin S:  software");
			System.out.println("Cin O: stereo");
			System.out.println("Cin Q: Quit");
			String s = null;
			try {
				String anString = in.readLine();
				s = anString;
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

			if (s.equals("C")) {
				System.out.println("You want to search computer");
				System.out.println();
				System.out.println("From the answer you can see ");
				System.out.println("if the conputer have MonitorSize,");
				System.out.println("it means the computer is a Desktop");
				System.out.println("else is a Laptop");
				System.out.println();
				for (int i = 0; i <= str.length; i++) {
					if (str[i][0] == null) {
						break;
					} else {

						if (str[i][0].equals("computer")) {
							System.out.println("name :" + str[i][1]);
							System.out.println("ID :" + arr2[i][6]);
							System.out.println("Price :" + arr1[i][0]);
							System.out.println("Description :" + str[i][2]);
							System.out.println("ProcessorName :" + str[i][5]);
							System.out.println("ProcessorSpeed :" + arr1[i][1]);
							System.out.println("Memory :" + arr2[i][3]);
							System.out.println("MonitorSize :" + arr2[i][4]);
							System.out.println("thickness :" + arr1[i][2]);
							System.out.println("weight :" + arr1[i][3]);
						}
						System.out.println();

					}
				}
				break;

			} else if (s.equals("S")) {
				System.out.println("You want to search software");
				for (int i = 0; i <= str.length; i++) {
					if (str[i][0] == null) {
						break;
					} else {
						if (str[i][0].equals("software")) {
							System.out.println("name :" + str[i][1]);
							System.out.println("D :" + arr2[i][6]);
							System.out.println("Price :" + arr1[i][0]);
							System.out.println("Description :" + str[i][2]);
							System.out.println("reqSpace :" + arr2[i][0]);
							System.out.println("os :" + str[i][3]);
							System.out.println("SoftType :" + str[i][4]);
						}
						System.out.println();

					}
				}
				break;

			} else if (s.equals("O")) {
				System.out.println("You want to search stereo");
				System.out.println();
				System.out.println("From the answer you can see ");
				System.out.println("if the stereo have channel,");
				System.out.println("it means the stereo is a Hometheater");
				System.out.println("else is a Cartheater");
				System.out.println();
				for (int i = 0; i <= str.length; i++) {
					if (str[i][0] == null) {
						break;
					} else {

						if (str[i][0].equals("stereo")) {
							System.out.println("name :" + str[i][1]);
							System.out.println("ID :" + arr2[i][6]);
							System.out.println("Price :" + arr1[i][0]);
							System.out.println("Description :" + str[i][2]);

							System.out.println("speakers :" + arr2[i][1]);
							System.out.println("watts :" + arr2[i][2]);
							System.out.println("channel :" + arr2[i][5]);
							System.out.println("removable :" + str[i][6]);
						}
						System.out.println();

					}
				}
				break;

			} else if (s.equals("Q")) {
				break;

			} else {
				System.out.println("No product can affer you!");
				System.out.println("Please cin again");
				System.out.println();

			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -